Install Rjava,xlsx,reporters package under Mac

Source: Internet
Author: User

The XLSX package can be used to read the Excel data, and the reporters package can be used to output the word report directly, both of which are dependent on the Rjava package, so the Rjava must be installed first.

(1) View Java information for your Mac

Java version:

> java–version

Java path:

>which Java

Java HOME:

>/usr/libexec/java_home

(2) Adding environment variables

Operation Steps:

1. Open Terminal

2. Input: VI ~/.bash_profile

3. Set Path:

Export java_home= "/usr/libexec/java_home-v 1.8"
Export Ld_library_path= $JAVA _home/jre/lib/server

4. Input: Wq Save Exit VI

5. Modification takes effect immediately: source ~/.bash_profile.

6. View environment variables: Echo $PATH

Attention:

Where the MAC configures environment variables

1./etc/profile (it is not recommended to modify this file)

A global (public) configuration that reads the file when logged on, regardless of the user.

2./ETC/BASHRC (typically add system-level environment variables to this file)

Global (public) configuration, which will be read by the bash shell, regardless of the way it is executed.

3.~/.bash_profile (typically add user-level environment variables to this file)

Each user can use the file to enter shell information dedicated to their own use, and when the user logs in, the file executes only once!

If you add a new environment variable or modify the value of an environment variable, you need a source to take effect immediately. If you delete an environment variable, you must enter exit to logout the current shell, and then reopen a new shell and login to take effect.

(3) The terminal executes the following statement:

>sudo R CMD javareconf

command line to open R, install Rjava:

Install.packages (' Rjava ', type= ' source ')

(4) Establish a link. Allow Rstudio to connect to Libjvm.dylib To/usr/local/lib via finder/spotlight:

sudo ln -f -s $(/usr/libexec/java_home)/jre/lib/server/libjvm.dylib /usr/local/lib
-f
(5) If you still cannot install reporters in R through the above steps, you need to download the latest in the Oracle website JDK . Then rerun the sudo R CMD javareconf

Install Rjava,xlsx,reporters package under Mac

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.