packages — install.packages / lapply

Check which packages are missing, install them, then load all at once with lapply.

utility
packages <- c(
  "ade4","ape","berryFunctions","betapart","biscale","cowplot","PCA_TRAITS.table",
  "dplyr","funrar","geiger","ggplot2","ggpubr","lsmeans","missForest","motmot",
  "multcomp","mvMORPH","paleotree","pals","paran","phylobase","phytools","picante",
  "plotly","plotrix","psych","quanteda","ratematrix","RColorBrewer","readr","rgbif",
  "rnaturalearth","rredlist","sf","shape","stats","tidyr","TPD","vegan",
  "VennDiagram","viridis","wesanderson"
)

installed_packages <- packages %in% rownames(installed.packages())
if (any(installed_packages == FALSE)) {
  install.packages(packages[!installed_packages])
}
# Packages loading
lapply(packages, library, character.only = TRUE)