Sign up ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Has anyone gotten RLink to work with Rtools (or even tried)? If so a simple step-by-step would be much appreciated !

When attempting to access any Rtools functionality through RLink I get:

The following R error was encountered: Error in system(cmd, intern = \ !verbose) : 'C:/Program' not found

Background: I'm trying to get data in and out of the RStan package with Mathematica (mostly because Mathematica is the program I've used most for manipulating data and the more I can do in Mathematica the less time I'll have to spend learning how to manipulate the data in R) and Rtools is required for RStan.

Thanks for the responses- Some new info in response to the comments: I installed R 2.15.3 (since version 3 doesn't work with RLink in Windows yet) Then:

InstallR["RHomeLocation" -> "C:\\Program Files\\R\\R-2.15.3"]

And that works for the basic RLink functionality. Through the R command line, I got the required packages installed. Then restart Mathematica, and check to make sure the packages are installed (which they are) and accessible - at least at the level that REvaluate["library(Rcpp)"] and REvaluate["library(rstan)"] both seem to work - returning a list of the loaded libraries. But then either running the "hello world" example from or trying to use any of the rstan commands results in the above error.

Any further thoughts?

share|improve this question
Use it all the time. Be sure you've got correct versions for your envir: it can be pissy about that. – ciao Feb 16 '14 at 22:43
I don't use either Rtools or R on Windows, but here's an idea: have you tried using an external R installation (through the "RHomeLocation" option of InstallR)? I think R 3.0 doesn't work with RLink on Windows, so you'd need to use an older version. – Szabolcs Feb 16 '14 at 23:08
@Szabolcs Wanted to suggest that too, but was thinking that may be rasher would expand his comment. If one uses the stand-alone R on Windows (but not R 3.x), one can use R's command line prompt too, to install packages (although on Windows, they can also be installed directly by RLink). – Leonid Shifrin Feb 16 '14 at 23:23
Haven't gotten around to trying this yet (and I'm not using Windows), but have you seen this comment in the installation instructions? "Mainly for Windows users, if Rcpp version is less than 0.10.3, it needs to be installed in a directory without space. So to avoid any issue that might come up if an old version of Rcpp was installed before, just update to the latest version." You could try update.packages() from the R command line. – Szabolcs Feb 19 '14 at 19:37
This question is a bit silly, but now that you have an external R installation, have you tried running it separately (not through RLink) and using RStan from it? Does it work that way? – Szabolcs Feb 19 '14 at 21:23

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.