> But I need to work with the names of the figure functions instead, something > like > > figlist <- paste0("fig", 1:3)
Are the functions exported or internal? # Use for internal functions pkg <- asNamespace("mypackage") # Use for exported functions: pkg <- "package:mypackage" # Find functions matching a pattern: figfuns <- grep("fun.*", ls(pkg), value = TRUE) # Convert names into functions funs <- lapply(fig, get, envir = pkg) onefig2 <- function(fig) { cat("Figure:", fig, "\n") print(body(fig)) fig() } lapply(funs, onefig2) Hadley -- RStudio / Rice University http://had.co.nz/ ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.