Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.5k views
in Technique[技术] by (71.8m points)

windows - Error after running build() to create R package in RStudio

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 AssemblyFileAssembler"  
--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)

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" 

The R version I am using is: R version 3.0.2 (2013-09-25) -- "Frisbee Sailing"

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

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

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" 

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.

from 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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...