On Jul 22, 2009, at 5:46 PM, kxk wrote:


I want to use read.table to input many files, each for a different year. I would like to use the macro variable 't' to refer to the exact file that I would like to input the data using read.table. How could I do this? Thank
you!

for (t in 1970:2005)
{ edge <- read.table(file="edge_t.csv", header=T,  sep=",")

Pretty sure that will not work. Take a look at the paste function for putting together strings and values.

paste("test", 1:3, sep="")

#[1] "test1" "test2" "test3"

And you might consider whether you want "edge" to be wiped out the next time through the loop, too. That is what would happen with your current construction.


## I will  have many rows of code following the read.table line
}

--

David Winsemius, MD
Heritage Laboratories
West Hartford, CT

______________________________________________
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.

Reply via email to