Change R default library path using .libPaths in Rprofile.site fails to work

后端 未结 15 2840
青春惊慌失措
青春惊慌失措 2020-11-22 06:27

I am running R on Windows, not as an administrator. When I install a package, the following command doesn\'t work:

> install.packages(\"zoo\")
Installing          


        
15条回答
  •  时光取名叫无心
    2020-11-22 06:58

    I've had real trouble understanding this. gorkypl gave the correct solution above when I last re-installed my OS & Rstudio but this time round, setting my environment variable didn't resolve.

    Uninstallled both R and Rstudio, creating directories C:\R and C:\Rstudio then reinstalled both.

    Define R_LIBS_USER user variable to your prefered directory (as per gorkypl's answer) and restart your machine for User variable to be loaded. Open Rstudio, errors should be gone.

    You can also use Sys.setenv() to modify R_LIBS_USER to the path of your alternative library which is easier and does not need to restart your computer.

    To see what R_LIBS_USER is set to: ?Sys.getenv()

    Reading help(Startup) is useful.

提交回复
热议问题