#批量运行包:
all.pcg <- c("data.table","ggplot2","rmarkdown","tidyr","stringr","ggfortify")
sapply(all.pcg, library, character.only = T)
req.pcg <- function(pcg){
new <- pcg[!(pcg %in% installed.packages()[, "Package"])]
if (length(new)) install.packages(new, dependencies = T)
sapply(pcg, require, ch = T)
}
req.pcg(all.pcg)

04-30 07:22