On Thu, 24 Jun 2010, Bert Gunter wrote:
You mean if a "package" has been installed?! (big difference)
?installed.packages or ?.packages with all.available = TRUE
Various people have suggested those. Can I point out that they are
very slow with a few thousand packages installed, especially on
Windows file systems and particularly the first. (A prime example of
how not to do it is 'ff', which calls installed.packages() to find its
own version: that takes minutes to load on my Windows desktop.)
You can use library(logical.return=TRUE) (or its wrapper require()) or
do as that does and use .find.package() (or its wrapper
system.file()).
?install.packages
Bert Gunter
Genentech Nonclinical Biostatistics
-----Original Message-----
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Ralf B
Sent: Thursday, June 24, 2010 12:26 PM
To: r-help@r-project.org
Subject: [R] Install package automatically if not there?
Hi fans,
is it possible for a script to check if a library has been installed?
I want to automatically install it if it is missing to avoid scripts
to crash when running on a new machine...
Ralf
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
--
Brian D. Ripley, rip...@stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.