相关文章推荐
调皮的石榴  ·  Laravel ...·  1 年前    · 
另类的人字拖  ·  mysql datetime ...·  1 年前    · 
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

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?

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:~$ 
                Thanks for your quick reply. It seemed indeed, that I was starting R differently from the console in the docker container and from asp.net. Now I set the environmental variable in my dockerfile ENV R_HOME=/usr/lib/R and R.NET seems to work.
– Qrt
                Apr 20, 2020 at 11:41
        

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.