Hi, I guess you want ?assign
See also this page for a working example, http://wiki.r-project.org/rwiki/doku.php?id=guides:assigning-variable-names HTH, baptiste 2009/9/29 David Young <dyo...@telefonica.net>: > 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 > > ______________________________________________ > 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. > ______________________________________________ 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.