Question

I am trying to install "rpart" package in R. But I am getting the following error.

> install.packages('rpart')
Warning in install.packages("rpart") :
  argument 'lib' is missing: using '/home/sandeep/R/i686-pc-linux-gnu-library/2.11'
Warning message:
In getDependencies(pkgs, dependencies, available, lib) :
  package ‘rpart’ is not available

Can anyone please tell whats the error about? How to solve?

Was it helpful?

Solution

A tip to start: If you're not sure whether you have a package already, you can use eg the function find.package() to check:

> find.package('rpart')
[1] "D:/R/library/rpart"
> find.package('lololool')
Error in find.package("lololool") : there is no package called 'lololool'

The problem is not so much that it is installed by default. It can be downloaded and installed from CRAN without problem using install.packages('rpart'), but if you check at the package page on CRAN, you see a very important line:

Depends:    R (≥ 2.13.0), graphics, stats, grDevices

which tells you that it is only available for R 2.13 and following versions. From your error, I deduce you still run 2.11. Quite some packages are not available for that old R version from CRAN any more, so you better update your R. Otherwise you'll run into this problem more often.

Be aware that if you run Debian, you'll have to do a bit more effort, as the default R in debian is always outdated. Just in case, you find the directions to do that here.

OTHER TIPS

I found that once I restarted RStudio that I was able to install the package and find.package() showed I did, now, have the packages.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top