Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
269 views
in Technique[技术] by (71.8m points)

r - Rtools is not being detected from RStudio

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 publish an app from the RStudio, I get the following error,

Preparing to deploy application...DONE Uploading bundle for application: 64015...Error: * Application depends on package "Rtools" but it is not installed. Please resolve before continuing. Execution halted

-- I have tried this,On Console,

> find_rtools(T)
Scanning path...
ls : D:Rtoolsinls.exe 
gcc: D:RtoolsGCC-46~1.3ingcc.exe 
VERSION.txt
Rtools version 3.3.0.1959 
Version: 3.3 
[1] TRUE

So, Rtools seems basically there!

-- I have checked environment variables, those are OK, as I also mentioned R and gcc can be started from command line

Yet, I tried to install and check from within RStudio using installr package, it says,

> install.Rtools()
No need to install Rtools - You've got the relevant version of Rtools installed
> 

-- This is not a possible duplication of this, Rtools not being detected by R I have tried all these. Did not work.

Please suggest a solution. Thank you very much for your time.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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/


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...