If you find yourself repeatedly wanting to use the same few functions from a package, the cleanest solution might be to create and load a package containing just those functions .
## Set up package source directory
dummy <- "" ## Need one object with which to initiate package skeleton
package.skeleton("dummy", "dummy")
## Clean up the man subdirectory
lapply(dir("dummy/man", full.names=TRUE), file.remove)
## Use NAMESPACE to pull in the functions you want
funs <- c("aaply", "ddply", "adply")
cat(paste0("importFrom(plyr, ", paste(funs, collapse=", "), ")"),
paste0("export(", paste(funs, collapse=", "), ")"),
file = "dummy/NAMESPACE",
sep = "\n")
## install the package
library(devtools)
install("dummy")
## Confirm that it worked
library(dummy)
ls(2)
# [1] "aaply" "adply" "ddply"
environment(aaply)
# <environment: namespace:plyr>
aaply(matrix(1:9, ncol=3), 2, mean)
# 1 2 3
# 2 5 8