On Thu, Dec 15, 2011 at 1:19 PM, anaraster <rrast...@gmail.com> wrote: > Hi > > How can I load libraries from a list containing the library names? > > Something like this > > ListOfLibraries=c("foreign","survival") > > for (in in 1:length(ListOfLibraries)){library(as.name(ListOfLibraries[i]))} > > I already tried this with no results.
Read the help for library and you'll see there's an option to help you. Also, use lapply to iterate over lists. Also also, they're PACKAGES! lapply(ListOfLibraries,function(x){library(x,character.only=TRUE)}) Barry ______________________________________________ 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.