Hot to set R home directory in r.net on docker/Debian?

1.4k views Asked by At

I try to use R.Net in an asp.net Razor App with docker support. The docker image is Debian 10, R is installed in the image under the standard path /usr/lib/R. When executing

REngine.SetEnvironmentVariables(rHome:"/usr/lib/R"); // or any other path including none
REngine engine = REngine.GetInstance();

I obtain the error R home directory is not defined. If I open a shell into my container and start R, R.home() returns /usr/lib/R. So it looks as if R in the container has a R home directory set, but r.net isn't recognizing it? Any ideas what I could try to fix this?

1

There are 1 answers

1
Dirk is no longer here On BEST ANSWER

You most likely invoke R the wrong way. Use /usr/bin/R which is a frontend which sets R_HOME for further use by the other components.

edd@rob:~$ file /usr/bin/R
/usr/bin/R: Bourne-Again shell script, ASCII text executable
edd@rob:~$ grep ^R_HOME /usr/bin/R 
R_HOME_DIR=/usr/lib/R
R_HOME="${R_HOME_DIR}"
edd@rob:~$