To resolve this issue quickly on your side, I would recommend installing
R on the C: drive which should have the short file names enabled by
default. Then, R.home() will return a path name without a space (short
file names do not include a space).
If you for some reason need to install R on the D: drive, then it might
be easiest to choose installation directory without the space, such as
"D:/R". Alternatively, you can enable short file names on your D: drive.
---
Re what could/should be fixed. I think code in R and packages should be
robust against space in file names, it should properly quote the file
names before passing to the OS. If you can debug this issue down to the
place where quoting (e.g. via shQuote) is missing, I'd be happy to fix
if it is in R code, please submit a bug report/patch. If it is in Rcpp
or other package you may contribute a patch/ask the package maintainer
to fix.
Best
Tomas
On 12/21/18 7:34 PM, qwey...@mail.ustc.edu.cn wrote:
https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=16660
Here is the bug, which R.home may generate a path contains a whitespace.
this will cause Rcpp failed executing sourceCpp
sourceCpp("b:/2018-12-14/src/18020/MCMC.cpp")
Error in system(cmd, intern = !showOutput) : 'D:/Program' not found
Error in system(cmd, ignore.stderr = TRUE, intern = TRUE) :
'D:/Program' not found
Code is tested in both R 3.5.1 and Microsoft R Open 3.5.1.
I find a temp solution, is to copy such words into Rprofile:
unlockBinding("R.home", baseenv())
utils::assignInNamespace("R.home",function (component = "home")
{
rh <- .Internal(R.home())
paste0('"',switch(component, home = rh, bin = if (.Platform$OS.type ==
"windows" && nzchar(p <- .Platform$r_arch)) file.path(rh,
component, p) else file.path(rh, component), share = if (nzchar(p <-
Sys.getenv("R_SHARE_DIR"))) p else file.path(rh,
component), doc = if (nzchar(p <- Sys.getenv("R_DOC_DIR"))) p else
file.path(rh,
component), include = if (nzchar(p <- Sys.getenv("R_INCLUDE_DIR"))) p
else file.path(rh,
component), modules = if (nzchar(p <- .Platform$r_arch)) file.path(rh,
component, p) else file.path(rh, component), file.path(rh,
component)),'"')
}, ns="base", envir=baseenv())
lockBinding("R.home", baseenv())
Actually, calling "D:/Program Files/R/R Open/bin/x64"/R is same to calling
"D:/Program Files/R/R Open/bin/x64/R"
it shows that we could use quote to quote the whitespaces.
(although the code seems a little bit ugly)
_
platform x86_64-w64-mingw32
arch x86_64
os mingw32
system x86_64, mingw32
status
major 3
minor 5.1
year 2018
month 07
day 02
svn rev 74947
language R
version.string R version 3.5.1 (2018-07-02)
nickname Feather Spray
[[alternative HTML version deleted]]
______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel