简体   繁体   中英

Does installing an R package with Rcpp require Rtools (Windows)

I am making an R package with Rcpp. It works fine on my machine which has Rtools installed. But recently, I tried to install my package locally on a different machine (Windows) and got a compiling error. The reason was that on that machine there was no g++ compiler (for Windows, g++ is provided with Rtools). After installing Rtools, it worked just fine.

So the question is, if I upload it to CRAN, does it still requires users to install Rtools by hand? Or does the function install.package() detect and install Rtools for them?

Also, if you guys know some packages written with Rcpp, please let me know. I'd like to take a look how it works.

So the question is, if I upload it to CRAN, does it still requires users to install Rtools by hand?

No.

Or does the function install.package() detect and install Rtools for them?

No.

What happens is that CRAN builds pre-compiled binary files that can be installed by Windows and MacOS users without the need for compilers and related tools.

Also, if you guys know some packages written with Rcpp, please let me know. I'd like to take a look how it works.

rr <- devtools::revdep("Rcpp")
length(rr) ## 907

or see the Rcpp page on CRAN .

Users , eg people who download it via install.package() , are actually downloading a "compiled" version of the packaged called a binary that is maintained by CRAN. They will only ever need a copy of R.

On the other hand, Developers , eg people who are creating it, require development tools that are system specific. For those on the Windows platform , they must have a local install of Rtools on their machine. For developers on macOS , they must have their own copies of gfortran binaries and xcode developer line tools .

Lastly, there are many such Rcpp packages available to look to for inspiration...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM