I try to follow the guide in http://adv-r.had.co.nz/Rcpp.html to understand Rcpp
but I always need to run devtools::find_rtools()
before any Rcpp function works:
If I do
library(devtools)
library(Rcpp)
has_devel() # Error: Command failed(1)
# Example from http://adv-r.had.co.nz/Rcpp.html
add <- cppFunction('int add(int x, int y, int z) {
int sum = x + y + z;
return sum;
}')
I get an error and Rstudio prompts me to install additional build tools (but nothing happens when I say yes). It looks like some make command fails, but system("where make")
gives a path that is in my PATH.
When I then do
find_rtools() # True
has_devel() # True
# Try the example again
add <- cppFunction('int add(int x, int y, int z) {
int sum = x + y + z;
return sum;
}')
# Now works
add(1,2,3) # 6
both devtools and Rcpp seem to be happy. Why is that and how can I fix that?
Here is the start of my PATH
path <- get_path()
head(path, 8)
[1] "F:\\Software\\R-3.3.0\\bin\\x64"
"F:\\Software\\Rtools\\bin"
[3] "F:\\Software\\Rtools\\gcc-4.6.3\\bin"
"F:\\Software\\Python 3\\Scripts\\"
[5] "F:\\Software\\Python 3\\"
"F:\\Software\\Rtools\\bin"
[7] "F:\\Software\\Rtools\\gcc-4.6.3\\bin"
"C:\\Program Files (x86)\\Intel\\iCLS Client\\"