Installing packages not yet on your system:
inst <- match(needed, .packages(all=TRUE)) need <- which(is.na(inst)) if (length(need) > 0) install.packages(needed[need])