4

I'm trying to install package rpart for R-2.14.0 on Windows 7, but I get the warning:

package ‘rpart’ is not available (for R version 2.14.0)

So I download the tar.gz file from the package page. I have installed Rtools but I disabled all the options, including the one that changes the PATH. Then I do the following:

> install.packages("C:/rpart_3.1-50.tar.gz", type="source")
Installing package(s) into ‘C:/Users/backupSam/Documents/R/win-library/2.14’
(as ‘lib’ is unspecified)
inferring 'repos = NULL' from the file name
* installing *source* package 'rpart' ...
** libs

*** arch - i386
ERROR: compilation failed for package 'rpart'
* removing 'C:/Users/backupSam/Documents/R/win-library/2.14/rpart'
* restoring previous 'C:/Users/backupSam/Documents/R/win-library/2.14/rpart'
Warning messages:
1: running command 'C:/PROGRA~1/R/R-214~1.0/bin/i386/R CMD INSTALL -l "C:/Users/backupSam/Documents/R/win-library/2.14"   "C:/rpart_3.1-50.tar.gz"' had status 1 
2: In install.packages("C:/rpart_3.1-50.tar.gz", type = "source") :
  installation of package ‘C:/rpart_3.1-50.tar.gz’ had non-zero exit status

Any suggestions?

11
  • 4
    May be a silly question, but have you checked that you have everything discussed here?
    – joran
    Nov 7, 2011 at 20:27
  • I'll be honest, I haven't but I'm lost/scared when it starts discussing setting the PATH. I ran the install for RTools without making any changes to the PATH or any other options. R and RTools are in separate directories though.
    – screechOwl
    Nov 7, 2011 at 20:43
  • I sympathize, but won't be much further help (my only experience is on OS X). All I can offer is that you should start Googling, and be scared enough about changing PATH to be very sure you know how to change it back, but not too scared to try at all.
    – joran
    Nov 7, 2011 at 20:51
  • 2
    @acesnap: you must put the location of Rtools in your path to be able to install packages from source. If you don't want to change it (semi) permanently, just open a cmd window, set the path, and run R CMD INSTALL. As it says in the link joran posted "This appendix contains a lot of prescriptive comments. They are here as a result of bitter experience. Please do not report problems to the R mailing lists unless you have followed all the prescriptions." Nov 7, 2011 at 21:01
  • 1
    You will need to change the PATH, but that part is not too bad. You just need to: (1) Right click on 'My Computer'; (2) Left click Properties; (3) Left click the 'Advanced' tab'; (4) Left click 'Environment Variables'; (5) Left click 'Path' in the 'System variables box; (6) Click 'Edit'; (7) Copy the contents of 'Variable value', and save it to a text file, so you can restore the value if you screw it up. Then, follow the instructions at the site @joran directed you to. I agree -- it's very intimidating before you do it -- but it does work, and it's worth taking the plunge. Nov 7, 2011 at 21:06

1 Answer 1

8

Since you have to set the PATH, but you're hesitant to do so because you're afraid you may hose something up, you can do it temporarily in your R session via:

pathRtools <- paste(c("c:\\Rtools\\bin",
  "c:\\Rtools\\MinGW\\bin",
  "c:\\MiKTeX\\miktex\\bin",
  "c:\\R\\bin\\i386",
  "c:\\windows",
  "c:\\windows\\system32"), collapse=";")
Sys.setenv(PATH=paste(pathRtools,Sys.getenv("PATH"),sep=";"))
1
  • This is also useful when you have multiple R installations on Windows and need to install a different Rtools for each of them.
    – Bob Jansen
    Mar 20, 2012 at 14:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.