That just creates one object and doesn't contain any $ subobjects in it. Here's what I did to figure it out (It's complicated):
for(i in c(1:13)) assign(paste("bc",i,sep=""),read.csv(paste(i,".csv",sep=""),sep="",header=TRUE)) in shorthand: for {assign(paste,read(paste))} This creates individual objects for each csv file and allows me to have $ subjects, e.g., bc1$foo. Thanks again, Vivek On Tue, Jul 28, 2009 at 2:12 PM, Steve Lianoglou<mailinglist.honey...@gmail.com> wrote: > Hi, > > On Jul 28, 2009, at 4:54 PM, Vivek Ayer wrote: > >> Hi all, >> >> I have 13 csv files and I want to assign each csv file to one object, >> i.e., >> >> bc1 <- read.csv("1.csv,header=TRUE,sep="") >> bc2 <- read.csv("2.csv,header=TRUE,sep="") >> bc3 ... >> >> So I want to create 13 objects. How could I automate this with a for loop? >> >> for (i in c(1:13)) ... >> >> Any ideas? > > > objects <- lapply(1:13, function(i) { > read.csv(paste(i, 'csv', sep='.'), header=TRUE, sep="") > }) > > -steve > > -- > Steve Lianoglou > Graduate Student: Computational Systems Biology > | Memorial Sloan-Kettering Cancer Center > | Weill Medical College of Cornell University > Contact Info: http://cbio.mskcc.org/~lianos/contact > > ______________________________________________ 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.