1

I'm working with a software project that requires the portable version of R platform. My intention is to use R in any version of Windows and in any compatible computer.

Problem: In Windows 7, R works fine without any worries, even in portable version. However, in Windows 10 (and probably also in Windows 8), R does not start when put the entire folder inside a directory containing whitespaces (ex.: "C:/Users/Main/Documents/My Folder/RVersion").

In Windows 10, with the absence of spaces, R runs fine. In the presence of spaces, all executable (Rscript.exe, R.exe, etc) except Rgui.exe just open a console and closes instantly. The problem is: I really need that R works in any folder (this is a important part of the project).

Additional information:

  • I found that R does not work well in directories without the 8dot3 format - and it think that Windows 10 lost this property, which was present in Windows 7. Also, the problem is clear when I run Rgui.exe in a whitespace-containing directory and try to run system("R.exe", intern=TRUE) function: It throws an error indicating that only the part before the first space in directory name was taken into account. Here is the message:

    > system("R.exe", intern=TRUE)
    

    [1] "'C:\\Users\\Main\\DOCUME~1\\My' nÆo ‚ reconhecido como um comando interno" [2] "ou externo, um programa oper vel ou um arquivo em lotes." attr(,"status") [1] 1 Warning message: running command 'R.exe' had status 1

Translation of messages [1] and [2]: "'C:\...\My'" not recognized as a internal or external command, nor a program operation or dataset

  • The same occurs with non-portable version of R, as I already tested.

  • When I run with a .bat file with the corrected (quoted) directory as input, R.exe runs, but in a disfunctional form and looking like cmd.exe (no R command worked).

  • I have no ideia how to change variables such as R_HOME to a readable version before R prompt starts.

System/Resources:

  • Windows 10 Home 64-bit with the last update.
  • Dell Notebook with Intel i7-5500U 2.40 GHz (not so relevant, I think)
  • R and R portable 3.3 (last version until this post), downloaded here: [https://sourceforge.net/projects/rportable/]

I believe that, with the popularity of Windows 10, many other users could face this problem (specially those who depend of R portability).

Thanks in advance!

SomethingDark
  • 13,229
  • 5
  • 50
  • 55
TojaraProg
  • 11
  • 4
  • Unaware of R portable but for full version if you need to call R scripts externally use [RScript.exe](http://stackoverflow.com/questions/3412911/r-exe-rcmd-exe-rscript-exe-and-rterm-exe-whats-the-difference) and pass path names as argument and any with spaces wrap in double quotes. I've called R from Python, PHP, Java, Excel, Access, PowerShell, Cmd Prompt, even Batch without issue in Windows 10. Please post specific script call for reproducible example. – Parfait May 12 '16 at 00:11
  • Thanks for the reply! Well, in fact, I want to run Rscript.exe in another moment, and I know that running only the executable Rscript.exe does anything. However, this is not the problem here, because I don't want to run a script externally. The problem is: I want to run R.exe and derivatives, but neither R.exe Rscript.exe works inside the directory with white spaces. When I rename the directory removing the whitespace, R.exe works fine. If you attempted this and worked, I wonder if you could give me some information about the version and the directory name that you tested, please. :-) – TojaraProg May 12 '16 at 00:20
  • Why do you want to run R.exe directly itself? R is intended as a programming language not an end-use software. Programmers never need to run python.exe, php.exe, java.exe etc. except to run scripts command line. – Parfait May 12 '16 at 00:34
  • I'm using R.exe as parameter to estimate R functionality. When I can run R.exe, I can run Rscript.exe externally and the other executables. I also tried to run Rscript.exe in C#.NET and it only worked when the R folder was in a directory without whitespaces, whose condition R.exe also worked. By the way, have you tested running the executables in this condition? (whitespace-containing directory) – TojaraProg May 12 '16 at 01:02
  • Additional note: You commented that you called the full version of R through many methods. You're right, this also worked well with me, but that's because I installed the full version inside Program Files. R does not take into account the space from Program Files (instead, it reads as something like PROGRAM~1, a 8dot3 name), but the user-created folders in Windows 10 are not registered with 8dot3 directory names, so the space in their names always will be read by R. – TojaraProg May 12 '16 at 01:32
  • Maybe you're right about Windows naming convention. Still scratching my head at what you are trying to do. Maybe some other SO user could help! – Parfait May 12 '16 at 02:01

1 Answers1

0

In the end, I found a plausible solution by myself. I realized that every time the R.exe is executed in a directory without spaces, the execution is automatically redirected to Rterm.exe. I don't know if they fixed the bug specifically to Rterm.exe in the last version, but this suggests that the Rterm executable is the responsible for opening the R console, and when I tried to execute it directly through a spaces-containing directory, it worked fine (at least in the last R version).

So, in summary, if someone else had this problem, just run Rterm.exe directly.

This resolution is useful enough for those who just depend on R portability, although the Rscript.exe and R.exe still are not working in these conditions. Rscript.exe is useful to execute scripts directly without the need to manually start a new session in a new window, and R.exe redirects to Rterm.exe based on your system, if it is 32-bit or 64-bit (at least as I observed).

Anyway, I already informed CRAN project about this bug, and I hope they check it and fix the issue in the next version. If someone else found an alternative solution, feel free to comment.

TojaraProg
  • 11
  • 4