[R] How to use macro variable in a text string

2009-07-22 Thread kxk
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,

Re: [R] How to use macro variable in a text string

2009-07-22 Thread Steve Lianoglou
Hi, 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

Re: [R] How to use macro variable in a text string

2009-07-22 Thread David Winsemius
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

Re: [R] How to use macro variable in a text string

2009-07-22 Thread Jorge Ivan Velez
Dear kxk, Here are a couple of options: # Option 1 -- sapply mydata - sapply(1970:2005, function(i){ mydata - read.table(file = paste(edge_, i, .csv, sep=), header=TRUE) # more code goes here } ) Please note that