I am using Win 7, 32 bit and R 3.2.0 I want to install few packages via script. The script should first check if the package is already installed (I dont want update).If the package is already there , then it would go to the next package in my list. How can I do this ? Parth
Selective package installation
3 messages · Partha Sinha, Brian Ripley, Uwe Ligges
On 18/05/2015 08:14, Partha Sinha wrote:
I am using Win 7, 32 bit and R 3.2.0 I want to install few packages via script. The script should first check if the package is already installed (I dont want update).If the package is already there , then it would go to the next package in my list. How can I do this ?
Take a look at the code of the built-in function new.packages(): what you ask for is a variant on what it does.
Brian D. Ripley, ripley at stats.ox.ac.uk Emeritus Professor of Applied Statistics, University of Oxford 1 South Parks Road, Oxford OX1 3TG, UK
4 days later
On 18.05.2015 09:14, Partha Sinha wrote:
I am using Win 7, 32 bit and R 3.2.0 I want to install few packages via script. The script should first check if the package is already installed (I dont want update).
assume the packages are given in a character vector pkg.
pkg <- c("MASS", "A")
Then:
inst <- installed.packages()[,1]
install.packages(setdiff(pkg, inst))
Best,
Uwe Ligges
If the package is already there , then it would go to the next package in my list.
How can I do this ? Parth
______________________________________________ R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.