3

So, now I have managed to compile the hello program of RInside on WindowsXP (VirtualBox). But, when I click on its executable, I get a dialogbox showing the above error.

Searching Google led me to this thread where they were talking about the following settings.

R:

> Sys.getenv("R_LIBS")
[1] ""
> Sys.getenv("R_LIBS_USER")
[1] "C:\\Documents and Settings\\admin\\My Documents/R/win-library/2.15"
> Sys.getenv("R_HOME")
[1] "C:/R-2.15.1"
> sessionInfo ()
R version 2.15.1 (2012-06-22)
Platform: i386-pc-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=English_United States.1252 
[2] LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

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

From here: http://cran.r-project.org/bin/windows/base/rw-FAQ.html#How-do-I-set-environment-variables_003f

The order of precedence for environmental variables is the order in which these options are listed, that is the command line then .Renviron then the inherited environment.

PATH:

enter image description here

Rcmd_environ:

## from R.sh
R_SHARE_DIR=${R_HOME}/share
R_INCLUDE_DIR=${R_HOME}/include
R_DOC_DIR=${R_HOME}/doc
R_ARCH=

## from Rcmd
R_OSTYPE=windows
TEXINPUTS=.;${TEXINPUTS};${R_SHARE_DIR}/texmf/tex/latex;
BIBINPUTS=.;${BIBINPUTS};${R_SHARE_DIR}/texmf/bibtex/bib;
BSTINPUTS=.;${BSTINPUTS};${R_SHARE_DIR}/texmf/bibtex/bst;

## from etc/Renviron
# R_PLATFORM='i386-pc-mingw32'
R_PAPERSIZE_USER=${R_PAPERSIZE}
R_PAPERSIZE=${R_PAPERSIZE-'a4'}
# for Rd2dpf, reference manual
R_RD4PDF=${R_RD4PDF-'times,inconsolata,hyper'}
## used for options("texi2dvi")
# R_TEXI2DVICMD=${R_TEXI2DVICMD-${TEXI2DVI-'texi2dvi'}}
## used by INSTALL, check, build
R_GZIPCMD=${R_GZIPCMD-'gzip'}
## Default zip/unzip commands
R_UNZIPCMD=${R_UNZIPCMD-'unzip'}
R_ZIPCMD=${R_ZIPCMD-'zip'}
R_BZIPCMD=${R_BZIPCMD-'bzip2'}
## Default browser
# R_BROWSER=${R_BROWSER-'open'}
## Default editor
# EDITOR=${EDITOR-${VISUAL-vi}}
## Default pager
# PAGER=${PAGER-''}
## Default PDF viewer
# R_PDFVIEWER=${R_PDFVIEWER-'open'}
# MAKE=${MAKE-make}
SED=${SED-sed}

R_LIBS=c:/DOCUME~1/admin/MYDOCU~1/R/win-library/2.15;

Rprofile:

# Things you might want to change

# options(papersize="a4")
# options(editor="notepad")
# options(pager="internal")

# set the default help type
# options(help_type="text")
  options(help_type="html")

# set a site library
.Library.site <- file.path(chartr("\\", "/", R.home()), "site-library")


# set a CRAN mirror
# local({r <- getOption("repos")
#       r["CRAN"] <- "http://my.local.cran"
#       options(repos=r)})

# Give a fortune cookie, but only to interactive sessions
# (This would need the fortunes package to be installed.)
#  if (interactive()) 
#    fortunes::fortune()

Please point out the point that I am missing.

Aquarius_Girl
  • 21,790
  • 65
  • 230
  • 411
  • Please replace the screen shots with text! – mnel Oct 30 '12 at 11:21
  • flagged to close as too localized as this was a user issue not a coding issue – mnel Oct 31 '12 at 05:43
  • @mnel I don't think this is too localized. All over on google (w.r.t this error) people were asked to set the R_HOME, but it wasn't said clearly anywhere that this R_HOME is not w.r.t R but w.r.t Windows. This thread has made the matters clear and Dirk has given a detailed explanation of the cause of the error. Now that this is solved its closing will not effect me, but I do request everyone NOT to "delete" this thread. This thread may help the future users. – Aquarius_Girl Oct 31 '12 at 06:14
  • I'm not suggesting deleting. If you can edit the question to succinctly reflect the specific issue the answer addresses, then I can see it has value. Although, given a fix is being implemented in the next release, it will be too localized anywar – mnel Oct 31 '12 at 06:22
  • Dear Aquarius, years later, I have encountered this debilitating error on my Windows 10 machine. Basically, I uninstalled R while Rstudio was running. Since then, I have completely removed and reinstalled both R (version 4.0.0) and Rstudio (version 1.2.5042) but the fatal error message still persists, do you know of any solution? -- Many many thanks, Reza – rnorouzian May 01 '20 at 17:42

1 Answers1

7

This error will get a little help in the next release. What happens is that when the RInside CRAN package gets built, R_HOME is detected and compiled in. With the value of the build machine. Ie not yours.

The answer is to a) build RInside locally so that it stores your R_HOME value or b) to set an enviroment variable R_HOME [ and needed only on Windows as only Windows can give you prebuilt versions ]. In the next version we'll also use some code from R to look in the registry for you; see the SVN repo.

This question has however been asked and addressed numerous times before.

Dirk Eddelbuettel
  • 360,940
  • 56
  • 644
  • 725
  • 4
    `This question has however been asked and address numerous times before.` I searched google before asking this, and found this question asked many times, but at the time I could not find any definite solution to this. I have even linked a thread in the question that I found. I'll see if your said solution helps. – Aquarius_Girl Oct 30 '12 at 11:30
  • 1
    `build RInside locally` : Actually I had used the default installer of R to install all the packages, this time I'll manually install it. `set an enviroment variable R_HOME` Couldn't5 understand this. R_HOME is already set as I showed in the above code. What should I include in it now? Somehow the path of RInside? Please clarify. – Aquarius_Girl Oct 30 '12 at 11:34
  • 1
    If you cannot set an environment variable (why?), try the new pre-release version that does this for you (and has some other changes): http://r-forge.r-project.org/R/?group_id=354 – Dirk Eddelbuettel Oct 30 '12 at 12:27
  • 1
    The R-Forge version may still have an issue but I just checked again with CRAN's Rcpp and RInside -- just do `set R_HOME=c:\R-2.15.1` and things should work. They do here. – Dirk Eddelbuettel Oct 30 '12 at 14:37
  • I think there is a communication gap. Please read my question details. I have already shown there that R_HOME "does" point towards `c:/R-2.15.1`. – Aquarius_Girl Oct 30 '12 at 14:44
  • Then I invite to debug the issue at your end. It works for everybody else. You seem to have been stuck at this for a while, so maybe something else in on. There is only so much I can do for you here. And as the docs repeatedly state, the rcpp-devel is the main avenue for help and support. – Dirk Eddelbuettel Oct 30 '12 at 14:49
  • Alright, thanks for your helpful attitude. I will post this to rcpp-devel. ***Question: Do you think there is some other technical information which I should provide here to help others to help me?*** – Aquarius_Girl Oct 30 '12 at 15:38
  • It's hard to say from here. It is helpful that you post a lot of info, but what purpose does filling the post with unaltered source and Makefiles have? – Dirk Eddelbuettel Oct 30 '12 at 15:42
  • `but what purpose does filling the post with unaltered source and Makefiles have?` Have you heard of the proverb ***"Drowning man catches at straw."*** ? :-) :-) Moreover, People here always keep on asking for a reproducible example, so just for the sake I added them... – Aquarius_Girl Oct 30 '12 at 15:46
  • This is SOLVED. It was my fault. I had set the environment variable R_HOME inside "R' GUI". In the question also, the output of R_HOME that I had shown was from R's GUI. I had set the system PATH of Windows but not the environment variable. Now, it is done. Thanks for you. Pardon my absent mindedness. – Aquarius_Girl Oct 31 '12 at 05:26
  • Dear Eric, years later, I have encountered this debilitating error on my Windows 10 machine. Basically, I uninstalled R while Rstudio was running. Since then, I have completely removed and reinstalled both R (version 4.0.0) and Rstudio (version 1.2.5042) but the `fatal error` message still persists, do you know of any solution? -- Many many thanks, Reza – rnorouzian May 01 '20 at 17:17