[R] Proper Paste for Data Member
David Winsemius
dwinsemius at comcast.net
Tue Jul 14 20:19:49 CEST 2009
On Jul 14, 2009, at 2:02 PM, Idgarad wrote:
> I imported a spreadsheet into a variable sh
>
> e.g. sh$aaaa, sh$bbbb, etc...
>
> doing the following:
>
> tsSource <- ts(paste("sh$",NAMEVARIABLE,sep="") ... )
From prior experience, my guess is that you want collapse= rather
than 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 at 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.
David Winsemius, MD
Heritage Laboratories
West Hartford, CT
More information about the R-help
mailing list