Rtools is not being detected from RStudio

前端 未结 3 636
遥遥无期
遥遥无期 2020-11-28 07:47

I am using latest R, RStudio and Rtools.

-- I have updated the environment variables. Now I can call gcc, or R from command line.

While I was trying to publi

3条回答
  •  广开言路
    2020-11-28 08:17

    I have no idea why RStudio has such kind of problems from time to time but there is a manual work-around described here:

    https://github.com/rwinlib/r-base/wiki/Testing-Packages-with-Experimental-R-Devel-Build-for-Windows

    Basically you have to set two environment variables to point to the correct installation path of Rtools:

    Sys.setenv(PATH = paste("C:/Rtools/bin", Sys.getenv("PATH"), sep=";"))
    Sys.setenv(BINPREF = "C:/Rtools/mingw_$(WIN)/bin/")
    

    To avoid losing this change after restarting RStudio you could modify your (Windows) environment variables instead or add the following rows to your .Renviron file that is executed at each startup of R.

    BTW: The $(WIN) part is no typo but required so that R can inject "32" or "64" depending on the R version you are using (32 or 64 bit).

    Edit 1: See also this r-bloggers article published recently: https://www.r-bloggers.com/quirks-about-running-rcpp-on-windows-through-rstudio/

提交回复
热议问题