Justin Thong Justin Thong - 4 months ago 30
R Question

Fatal Error for Rcpp in Rstudio on windows machine

I have R Studio(and R of course) and am aiming to use the Rcpp package.I am using a windows machine.


  1. I installed R tools. The folder lies in C:\Rtool

  2. I changed my PATH in control panel->system->advanced system settings->environment variables and added 2 new PATH s C:\Rtools\mingw_32\i686-w64-mingw32\bin and C:\Rtools\bin with each of those at the top of the list of PATHs

  3. I restarted my computer

  4. Started a new C++ script in rstudio

  5. Loaded the rcpp package with library()

  6. Ran the pre-existing code(timesTwo) by hitting the Source button in horizontal bar.



And I get an error message


The application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information


Also a pop-up alert comes out stating


R Session Aborted. R encountered a fatal error. The session was terminated.


By running library(rcpp) and sessionInfo() I get version information

R version 3.3.1 (2016-06-21)
Platform: i386-w64-mingw32/i386 (32-bit)
Running under: Windows >= 8 x64 (build 9200)
locale:
[1] LC_COLLATE=English_Malaysia.1252 LC_CTYPE=English_Malaysia.1252
[3] LC_MONETARY=English_Malaysia.1252 LC_NUMERIC=C
[5] LC_TIME=English_Malaysia.1252

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] Rcpp_0.12.6

loaded via a namespace (and not attached):
[1] tools_3.3.1


Can anyone tell me what is wrong and how can I fix it?

Answer

Two issues:

  1. You are using 32 bit version of R on a 64-bit OS
  2. The path setup for Rtools is incorrect.

The path should have:

c:\Rtools\bin;
c:\Rtools\mingw_32\bin;

For more help on install Rtools correctly, please see this guide:

http://stat385.thecoatlessprofessor.com/announcements/2016/07/25/install-rtools-for-rcpp/