installing and checking if a package is there
if (!require("gplots")) { + install.packages("gplots", dependencies = TRUE) + library(gplots) + }