我试着按照该指南中http://adv-r.had.co.nz/Rcpp.html了解RCPP 但我总是需要运行devtools::find_rtools()
任何RCPP功能的工作原理之前: 如果我做为什么我需要在has_devel()= TRUE之前运行find_rtools()?
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;
}')
我得到一个错误,Rstudio提示我安装额外的构建工具(但是当我说是时没有任何反应)。它看起来像一些命令失败,但system("where make")
给出了我的路径中的路径。 当我再做
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
两个devtools和RCPP似乎是幸福的。为什么是这样的,我该如何解决这个问题?
这里是我的道路开始
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\\"
是从一个干净的R对话这条道路? 'find_rtools()'只修改你的路径。如果您希望在不必运行devtools的情况下永久工作,请通过环境变量对话框(在Windows开始菜单中)更改路径。 – Thomas
是的,那是来自干净的会议。 但是路径中缺少哪个目录,Rtools似乎至少有一些目录? – luoar