Installing an R Package if Required

When you have serveral packages for your code and you dont know which are already installed a good way to do this programatically is as follows. list.of.packages <- c("package1", "package2", "package3")new.packages <- list.of.packages[!(list.of.packages %in% installed.packages()[,"Package"])]if(length(new.packages)) install.packages(new.packages) Referenced from here.

r Package Install Error ‘unable to move temporary installation’

When installing the 'rgdal' package I got the error package ‘rgdal’ successfully unpacked and MD5 sums checkedWarning in install.packages :unable to move temporary installation It seems the antivirus software is delaying the install. The workaround is to slow it down by the following: debug(utils:::unpackPkgZip)install.packages("packageName") Then just keep hitting the 'Next' button to execute the next … Continue reading r Package Install Error ‘unable to move temporary installation’