# Check R version
R.Version()
$platform
[1] "x86_64-w64-mingw32"
# OUTPUT OMITTED
$version.string
[1] "R version 3.4.3 (2017-11-30)"
# Check devtools for Rtools installation
devtools::find_rtools()
[1] TRUE
然而,当我按Ctrl+Shift+B在RStudio中构建包时,我被告知找不到Rtools:
==> devtools::build()
"C:/PROGRA~1/R/R-34~1.3/bin/x64/R" --no-site-file --no-environ --no-save \
--no-restore --quiet CMD build \
"C:\Users\name\mypkg" --no-resave-data \
--no-manual
* checking for file
'C:\Users\name/mypkg/DESCRIPTION' ... OK
* preparing 'mypkg':
* checking DESCRIPTION meta-information ... OK
* checking for LF line-endings in source and make files and shell scripts
* checking for empty or unneeded directories
* building 'mypkg_0.1.0.tar.gz'
[1] "C:/Users/name/mypkg_0.1.0.tar.gz"
Source package written to C:/Users/brett/Dropbox/Duke/package_development
WARNING: Rtools is required to build R packages but is not currently
installed. Please download and install the appropriate version of Rtools
before proceeding:
https://cran.rstudio.com/bin/windows/Rtools/
以前关于这个问题的文章(见:
Rtools not being detected by R
R 3.3.0 installing a package on Windows: gcc not found error
). 在我的例子中,在显示系统路径的代码下面,两个工具链框都被选中(参见图)。
# Check system path
Sys.getenv()['PATH']
PATH C:/Rtools/bin;C:\Rtools\bin;C:\Program
Files\R\R-3.4.3\bin\x64;C:\Rtools\bin;C:\Program
Files (x86)\Intel\iCLS Client\;C:\Program
Files\Intel\iCLS
Client\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program
Files (x86)\Intel\Intel(R) Management Engine
Components\DAL;C:\Program Files\Intel\Intel(R)
Management Engine Components\DAL;C:\Program
Files (x86)\Intel\Intel(R) Management Engine
Components\IPT;C:\Program Files\Intel\Intel(R)
Management Engine Components\IPT;C:\Program
Files\MiKTeX 2.9\miktex\bin\x64\;C:\Program
Files
(x86)\PharosSystems\Core;C:\WINDOWS\System32\OpenSSH\;C:\Users\name\AppData\Local\Microsoft\WindowsApps;
RStudio cannot find Rtools to build package
有人能为Rstudio中检测rtools的解决方案提供建议吗?