I’ve been following the Rstan installation page at
and I’ve got down to the very end but when I do the final thing
Verify that your toolchain works by executing the code below in R and checking that it returns the value 10:
fx ← inline::cxxfunction( signature(x = “integer”, y = “numeric” ) , ’
return ScalarReal( INTEGER(x)[0] * REAL(y)[0] ) ;
’ )
fx( 2L, 5 ) # should be 10
I get this error message
> fx <- inline::cxxfunction( signature(x = "integer", y = "numeric" ) , '
+ return ScalarReal( INTEGER(x)[0] * REAL(y)[0] ) ;
+ ' )
Error in system(cmd, intern = !verbose) : 'D:/Program' not found
> fx( 2L, 5 ) # should be 10
Error in fx(2L, 5) : could not find function "fx"
I am using R 3.4.1 installed in D:\Program Files\R\R-3.4.1
Windows 8 (I think) 32 bit
Rtools is in D:\Rtools.
I don’t have enough room to put R on my C drive. So how can I get it to work with my D drive.
I had correctly changed the file path to “D:/Rtools/mingw_32/bin/” and I’ve just double-checked that it points to the right place by pasting it into windows explorer and fixing the "/"s … so that’s not the problem.
I added CXX=“D:\Program Files\Rtools\mingw-32\bin\g++” to the Makevars file but I still get the same error message as in my first post…
From my rather meagre knowledge it looks like “it” is treating "“D:/Program” as a separate thing rather than recognising that “D:/Program files/somewhere” is one entire thing.
I have Rtools in D:/Rtools.and R in D:\Program Files\R\R-3.4.1 so it’s trying to do something in RStan rather than Rtools.
Disclaimer - my knowledge may be even more meagre than yours, so forgive me if if I am suggesting things you may have already considered.
When you mean "…fixing the "/"s… " Did you end up using forward slashes or backslashes?
You wrote:
I added CXX=“D:\Program Files\Rtools\mingw-32\bin\g++” (backslashes)
and “it” is treating "“D:/Program” as a separate thing (forward slash)
I remember trying doubling backslashes (\\) and also using forward slashes in the expression. Unfortunately I cannot remember which worked in the end.
My case was also simpler because I avoid spaces in directory/file names from a habit I took under Linux. I do not understand quite enough to explain clearly but your problem really smells like a “space escape problem”. Hypothesis: when “it” encounters the space character, “it” thinks this is the end of that token and then cannot find the specified D:\Program. I would explore that path (sorry for the bad pun) as you search for a solution.
Again, sorry if I propose things you already duly considered. Good luck.
In the end I re-installed R at D:\R\R-3.4.1 rather than D:\Program Files\R\R-3.4.1 and, after working out what things I’d fiddled with and undoing them, it all seems to be working now.