I imported a spreadsheet into a variable sh e.g. sh$aaaa, sh$bbbb, etc...
doing the following: tsSource <- ts(paste("sh$",NAMEVARIABLE,sep="") ... ) fails. The paste isn't evaluating properly. What is the proper way to concatenate a data source with a member name such that they evaluate properly. actual code below: doEnv <- function(SOURCEDATA,REGDATA,HOUR,ENVNAME,REPORTNAME) { print(SOURCEDATA) print(REGDATA) print(HOUR) print(ENVNAME) print(REPORTNAME) # blah blah blah ... #Raw Data channel1 <- odbcConnectExcel("Q:/metrics.xls") sqlTables(channel1) sh1 <- sqlFetch(channel1, "Actuals$") close(channel1) # Something here is borked like the Chef himself.... tsSource<-ts(paste("sh1$",ENVNAME,sep=""),start=c(2004,1),freq=52) print(tsSource) plot(tsSource,col="grey",type="n") return("AUTOBOT") # I use AUTOBOT or DECEPTICON for generic pass fail return values. Yes I am a geek... } [[alternative HTML version deleted]] ______________________________________________ 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.