Skip to content

Selective package installation

3 messages · Partha Sinha, Brian Ripley, Uwe Ligges

#
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
#
On 18/05/2015 08:14, Partha Sinha wrote:
Take a look at the code of the built-in function new.packages(): what 
you ask for is a variant on what it does.
4 days later
#
On 18.05.2015 09:14, Partha Sinha wrote:
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