[R] How to reinstall rpart?

Uwe Ligges ligges at statistik.uni-dortmund.de
Sat Aug 16 13:05:14 CEST 2003



David Parkhurst wrote:
> 
> After entering “library(rpart)”, I tried to plot an existing rpart tree, and
> got this error message:  Error: couldn't find function "plot.rpart".
> However, “?plot.rpart” does bring up the help for the function.  The same
> things occur for text.rpart, although print(my.tree) does work.
> 
> So, I tried to re-install rpart using Packages  | Install from CRAN, but
> then I get this message:––––––––––––––––––––––––––––––––––––––––––––––––––-
> 
> > local({a <- CRAN.packages()
> 
> + install.packages(select.list(a[,1],,TRUE), .libPaths()[1], available=a)})
> 
> trying URL `http://cran.r-project.org/bin/windows/contrib/1.7/PACKAGES'
> 
> Content type `text/plain; charset=iso-8859-1' length 12560 bytes
> 
> opened URL
> 
> downloaded 12Kb
> 
> trying URL
> `http://cran.r-project.org/bin/windows/contrib/1.7/rpart_3.1-12.zip'
> 
> Content type `application/zip' length 231827 bytes
> 
> opened URL
> 
> downloaded 226Kb
> 
> Error in unpackPkg(foundpkgs[okp, 2], pkgnames[okp], lib, installWithVers) :
> 
>         Can not remove prior installation of package
> 
> ––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
> 
> Evidently I need to uninstall first, but I can’t figure out how.  I’ve
> looked in the pdf manuals, in the R FAQ, and in the R for Windows FAQ, and
> don’t find instructions for doing so.  I’d appreciate any help.  Thanks.
> 
> Dave Parkhurst

Since Ko-Kang Kevin Wang already told that the usage of the generic
plot() instead of its method plot.rpart() (same for text() and
text.rpart(); interestingly you haven't tried print.rpart() instead of
print()) is the solution of your first questions (for details see the
article on Namespaces in the recent R News), let's take a look at the
second:

Windows locks DLLs that are in use, so I guess the package rpart was in
use while you tried to reinstall. See the R for Windows FAQ 3.8 for
details. You can uninstall packages manually as well: Just delete the
packages directory (as the default, it's
.../rw1071/library/PackageName).

Uwe Ligges




More information about the R-help mailing list