Load R package from character string

Solution 1:

Use the character.only argument

foo <- "ggplot2"
library(foo,character.only=TRUE)