Use external R packages

Package installation is persistent, but you cannot know in advance which node of the cluster will launch your job.

Thus don't assume packages are already installed:

options(repos = "https://cloud.r-project.org")
pkgs <- c("data.table", "dplyr", "ggplot2")
for (pkg in pkgs) if (!length(find.package(pkg, quiet = TRUE))) install.packages(pkg)
for (pkg in pkgs) library(pkg, character.only = TRUE)