[R] Install package automatically if not there?
Ista Zahn
istazahn at gmail.com
Thu Jun 24 21:38:26 CEST 2010
Hi Ralf,
Ralf B <ralf.bierig at gmail.com> writes:
> 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...
You could do something like
if ("somepackage" %in% row.names(installed.packages()) == FALSE)
install.packages("somepackage")
-Ista
>
> Ralf
>
> ______________________________________________
> R-help at 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.
More information about the R-help
mailing list