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