简体   繁体   中英

Set R_HOME for MAC OSX for application to access R

I have an application that can call R from it. It tells me error: "The location of the R installation must be set with the R_HOME environment variable"

I need to set up R_HOME to where R is located on my machine. /usr/bin/R.

When I type echo $R_HOME I get a blank. What is the best way to set R_HOME? I have OSX 10.9.2 installed. If the path is set to /usr/bin/R will this be enough or is something more complex needed.

Are you sure it needs the full pathname to the R binary? (see my comment above). This is, on Unix-like systems, always $R_HOME/bin/R Now, $R_HOME is usually not supposed to be set directly (R sets it itself), but it may be that the program calling R knows that R can be found at $R_HOME/bin/R . In that case, do

export R_HOME=$(R RHOME)

and you should be fine.

Place it in your ~/.bash_profile file:

export R_HOME=$(which R)

Then from the command line try

source ~/.bash_profile
echo $R_HOME

For example, I see /usr/bin/R .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM