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
650 views
in Technique[技术] by (71.8m points)

r - Message error 'C:/Program' not found with Rcpp

I'm running a 64-bit Windows 7 platform.

I have added to my installed programs/libraries:

  • Rtools

  • R (software)

  • Rcpp (R package)

  • inline (R package)

I tried out a snippet found here

## now with Rcpp and C++
library(inline)
# and de?ne our version in C++
src <- "int n = as<int>(ns);
double x = as<double>(xs);
for (int i=0; i<n; i++) x=1/(1+x);
return wrap(x); "
l <- cxxfunction(signature(ns="integer", xs="numeric"),
body=src, plugin="Rcpp")

But that doesn't work (That is not a surprise to be honest as I even didn't specified eg the location of Rtools). I get the following error message:

Error in system(cmd, intern = !verbose) : 'C:/Program' not found

I'm not sure of what that means. And, I have been stuck there for a couple of hours now. Can anyone help me a bit, please?

See Question&Answers more detail:os

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

1 Answer

0 votes
by (71.8m points)

The R on Windows FAQ says in Question 2.2:

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

Also see Question 2.16 of that FAQ. I am fairly certain that we also make that point repeatedly in the Rcpp documentation.

Now, if you forgo the inline package, and try working in RStudio, then you might get around this (as there are more efforts to protect the $PATH with spaces).

But in short, I would reinstall R into, say C:RR-$version as it is the only way to get default behaviour on all examples. And we have lots of them. It's worth reinstalling.


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

...