rpart package installation in R

16,565

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.

Share:
16,565
Sandeep
Author by

Sandeep

Studying MTech at IIIT-Bangalore

Updated on June 04, 2022

Comments

  • Sandeep
    Sandeep about 2 years

    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?

    • Sandeep
      Sandeep over 12 years
      The problem got solved. Actually, in my system "rpart" package already installed. It will come by default through r-core. But its not showing anything when i am trying to install again. This may be the "bug". By loading package using library(rpart), I am able to use "rpart" function now.
  • Matt Bannert
    Matt Bannert over 12 years
    you may also want to use search()to check what's already loaded.
  • Joris Meys
    Joris Meys over 12 years
    @ran2: thx. Indeed, that's possible, but it won't show up installed packages if they're not loaded.