rstudio find out if package is installed code example
Example: rstudio find out if package is installed
#Easy way to check if packages are already installed in RStudio
packages <- c("ggplot2", "dplyr", "Hmisc", "lme4", "arm", "lattice", "lavaan")
if (length(setdiff(packages, rownames(installed.packages()))) > 0) {
install.packages(setdiff(packages, rownames(installed.packages())))
}