[R] Macro variable substitution
David Young
dyoung at telefonica.net
Tue Sep 29 17:58:29 CEST 2009
Hello All,
I'm a new R user and have a question about what in SAS would be called
macro variable substitution. Below is some R code that doesn't work,
but I think it will illustrate what I'd like to do.
readfunc<-function(x) {
x <<- read.table(paste(x,".csv",sep=""), header=TRUE,sep=",")
}
readfunc(TEF)
What I'd like to do is have the letters "TEF" become the name of the new
R data and also be used in conjunction with ".csv" to read the file
"TEF.csv".
So working R code looks like this:
TEF <- read.table(TEF.csv, header=TRUE,sep=",")
but I'd like to type the changing letter sequence just once.
Any suggestions would be appreciated.
--
Best regards,
David Young
Marketing and Statistical Consultant
Madrid, Spain
+34 913 540 381
http://www.linkedin.com/in/europedavidyoung
More information about the R-help
mailing list