运行 build() 在 RStudio 中创建 R 包后出错 [英] Error after running build() to create R package in RStudio

查看:52
本文介绍了运行 build() 在 RStudio 中创建 R 包后出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 Windows 8 Pro 上使用 RStudio 构建 R 包.当我尝试通过运行 build() 来构建包时,出现错误:

I am trying to build an R package using RStudio on Windows 8 Pro. When I attempt to build the package by running build() I get the error:

"C:/Program Files/R/R-30~1.2/bin/x64/R" --vanilla CMD build "H:\File Assembly\FileAssembler"  \
--no-manual --no-resave-data 

'C:\Program' is not recognized as an internal or external command, operable program or batch file.
Error: Command failed (1)

我已经安装了 MiKTEX 并且我已经通过以下方式进行了检查:

I already have MiKTEX installed and I have checked this by:

Sys.which("pdflatex") 
                                                        pdflatex
"C:\\Program Files (x86)\\MIKTEX~1.9\\miktex\\bin\\pdflatex.exe" 

我使用的R版本是:R version 3.0.2 (2013-09-25) -- "Frisbee Sailing"

加载库(devtools)并运行 find_rtools(T) 给出:

Loading library(devtools) and running find_rtools(T) gives:

find_rtools(T)  
Scanning path...
ls : c:\Rtools\bin\ls.exe 
gcc: c:\Rtools\GCC-46~1.3\bin\gcc.exe 
VERSION.txt
Rtools version 3.1.0.1942 
Version: 3.1 
[1] TRUE

另外,rtools exe 的路径是:

In addition, the path for rtools exes are:

Sys.which("ls.exe")
                   ls.exe 
"c:\\Rtools\\bin\\ls.exe" 

Sys.which("gcc.exe")
                               gcc.exe 
"c:\\Rtools\\GCC-46~1.3\\bin\\gcc.exe" 

并检查 R 中的路径:

And checking the path in R:

Sys.getenv('PATH')
[1] "C:\\Program Files\\R\\R-3.0.2\\bin\\x64;c:\\Rtools\\bin;c:\\Rtools\\gcc-4.6.3\\bin;……other paths…………;C:\\Program Files (x86)\\MiKTeX 2.9\\miktex\\bin\\"

我非常感谢您帮助我确定我遗漏了什么.

I would really appreciate help with identifying what I have missed out.

推荐答案

这是由安装位置路径 (C:\Program Files) 中的空格引起的常见错误.解决方案和官方 R 建议是,如果您希望能够从源代码安装软件包,请不要在 Windows 上有空格的位置安装 R.

This is a common error caused by a space in the install location path (C:\Program Files). The solution, and the official R recommendation is that you never install R in a location with spaces in it on Windows if you want to be able to install packages from source.

来自 http://cran.r-project.org/bin/windows/rw-FAQ.html#How-do-I-install-R-for-Windows_003f:

如果您希望能够从源代码构建包,我们建议选择不包含空格的安装路径.

If you want to be able to build packages from sources, we recommend that you choose an installation path not containing spaces.

这篇关于运行 build() 在 RStudio 中创建 R 包后出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆