Dear all, I am trying to read in and assign data from 50 tables in an automated fashion. I have the following code, which I created with the help of textbooks and the internet, but it only seems to read in the final data file over and over again. For example, when I type:> table_1951 I get the same values in the table as when I type> table_2000 despite the values in the source tables being different:
year <- 1951:2000 filelist <- paste("C:\\Documents and Settings\\Data\\table_",year,".txt", sep="") filelist # Code seems to operate successfully up to this point for (i in filelist) { for (iyear in 1951:2000) { assign(paste("table_",iyear, sep=""),read.table(file=i, header=TRUE, sep=",")) noquote(paste("LOADED FILE:",paste("table_",iyear, sep=""),sep=" ")) } } Can anyone see what I've done wrong here? And just as an aside, as you can see, I've inserted the 'noquote' line so that when the code is running I should be able to see each file being read in - mainly as a 'checker'. Should this work as anticipated, with each line being displayed with its corresponding table number after it's been read in? Many thanks for any help offered, Steve _________________________________________________________________ [[elided Hotmail spam]] ______________________________________________ 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.