0

I have a problem in using Rcpp from Rexcel. (especially, sourceCpp() function)

I'm running a 64-bit Windows 10 platform. I installed R ver 3.3.1 and RExcel. I also installed Rtools by Rtools34.exe. I can use RExcel properly if I don't use sourceCpp().

Hoewver, when I use sourceCpp() function, I have an error.

From Rexcel, I execute the command

library(Rcpp)

and this step, there is no error.

Next, I put the following command

sourceCpp("C:/Users/ChrisCCCCC/Desktop/ChrisCCCCC/program/samplecode.cpp")

and Run code.Then, the error message

Error in command: 
sourceCpp("C:/Users/ChrisCCCCC/Desktop/ChrisCCCCC/program/samplecode.cpp")

  'C:/Program' not found
attr(,class)
[1] try-error

Is anyone else know the reason of this error?

Of course I set the path for Rtools. and I can run the code

sourceCpp("C:/Users/ChrisCCCCC/Desktop/ChrisCCCCC/program/samplecode.cpp")

with no error from normal RGui and RStudio.

Why sourceCpp() causes an error through RExcel while there is no error through normal RGui?

Can anyone help me, please?

nicola
  • 24,005
  • 3
  • 35
  • 56
Chris
  • 9
  • 2
  • The `C:/Program` part looks familiar: a quoting problem, where the path `c:/program files/...` or `c:/program files (x86)/...` has not been quoted, so that the part before the space is interpreted as program name. The question then is what configuration or code is guilty of this. I'm not familiar with R so, sorry, can't help with that. – Cheers and hth. - Alf Sep 17 '16 at 06:10
  • By the way, trouble with spaces in paths is a very common quality problem with code ported to Windows from Unix-land. You can also expect problems with national characters. One way to avoid it is to make sure that software never sees a path with a space (or national character). And one way to do that is to use DOS 8.3 filesystem item names. Another way, to map a local drive letter (`subst` command) to relevant directory. Yes it's awkward, and it's really remarkable that this problem just persists and persist over the years. But. – Cheers and hth. - Alf Sep 17 '16 at 06:13
  • I think RExcel is a commercial program so you should be able to get support from the vendor. – IRTFM Sep 17 '16 at 06:23
  • Thank you for your valuable comments. I read your comments, and re-installed R and RExcel not to include the space. And then, I can run the code with no errors. Thank you!!! – Chris Sep 20 '16 at 08:50

0 Answers0