Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I set R.HOME() and/or R_HOME correctly?

Tags:

windows

r

I have my R installed in C:\R\R-3.3.0. But:

> R.home()
[1] "C:/R/R-33~1.0"
> Sys.getenv("R_HOME")
[1] "C:/R/R-33~1.0"

I think both should be "C:/R/R-3.3.0" as I have quite a lot of trouble when using the debugger: It just does not find the libraries!

As I am on Windows, I read this in the documentation, but it did not help:

On Windows the values of R.home() and R_HOME are switched to the 8.3 short form of path elements if required and if the Windows service to do that is enabled. The value of R_HOME is set to use forward slashes (since many package maintainers pass it unquoted to shells, for example in ‘Makefile’s).

Help is higly appreciated, because my knowledge about environment variables is tiny.

like image 595
Christoph Avatar asked Jul 07 '16 09:07

Christoph


People also ask

How do I get r home?

You can find R_HOME by running the command R. home(component = "home") in a session of that version of R. So, for example, if you find that R_HOME is /opt/R/3.6.

What is HOME directory in R?

The R home directory is the top-level directory of the R installation being run. The R home directory is often referred to as R_HOME , and is the value of an environment variable of that name in an R session. It can be found outside an R session by R RHOME .


1 Answers

Thanks to @Morgan I found the answer here:

The "short name" is really the old DOS 8.3 naming convention, so all the directories will be the first 6 letters followed by ~1 assuming there is only one name that matches

like image 119
Christoph Avatar answered Oct 19 '22 04:10

Christoph