Hi Thomas,

Here are two suggestions which storage all the files in a list:

# Parameters
route <- "/Users/thomasjackson/Data/GEP&CO/GEP&CO"
lts <- LETTERS[1:12]
toread <- paste(route,lts,"/HPLC_",lts,"12.csv",sep='')

# Reading in the data   -- option 1
myfiles <- list()
for(i in 1:12)  myfiles[i] <- read.csv(toread, header=T, sep=',')
names(myfiles) <- paste("G&P", lts, sep='')
myfiles

# Option 2   -- no for() loop
myfiles2 <- lapply(toread, read.csv, header=T, sep=',')
myfiles2

To access the first file just type either

myfiles[[1]]

or

myfiles2[[1]]

For further analysis using each file, the lapply (see ?lapply) function
might be useful.

HTH,
Jorge


On Thu, Nov 19, 2009 at 12:29 PM, Thomas Jackson <> wrote:

> Dear R Users,
>
> I am trying to read in a series of csv files which vary by the letter on
> the end of he file name.  When I input what seems to be a logical for loop I
> get an error message that doesn't make sense to me.
>
> > for(i in 1:12){ paste("G&P", LETTERS[i],sep='')
> <-read.csv(paste("/Users/thomasjackson/Data/GEP&CO/GEP&CO",LETTERS[i],"/HPLC_",LETTERS[i],"12.csv",sep=''),
> header=T, sep=',')}
>
>
> Error in paste("G&P", LETTERS[i], sep = "") <-
> read.csv(paste("/Users/thomasjackson/Data/GEP&CO/GEP&CO",  :
>  target of assignment expands to non-language object
>
>
> For example the first file name is HPLC_A12.csv in the folder GEP&COA
>
> Thanks for any help,
> Thomas Jackson
> ______________________________________________
> 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.
>

	[[alternative HTML version deleted]]


