[R] getting a timeseries element into a string

tradenet nodecorum at yahoo.com
Fri Jul 10 17:40:54 CEST 2009


I have a timeseries object, ts, and want to get the first date in the series
into a string so I can concatenate it with a SQL query. Input and output are
shown below.  I must be missing something very basic, but I can't seem to
pry the data ("2008-07-01") into a string variable.  Any suggestions would
be appreciated.

Thank you,

Andrew

=====script:
class(ts)
(ts[1,0])  #returns first date in return series
ttt<-(sprintf("%s",ts[1,0]))
print(ttt)

=====output:


> class(ts)
[1] "timeSeries"
attr(,"package")
[1] "timeSeries"

> (ts[1,0])  #returns first date in return series
GMT

2008-07-01

> ttt<-(sprintf("%s",ts[1,0]))

> print(ttt)
character(0)



-- 
View this message in context: http://www.nabble.com/getting-a-timeseries-element-into-a-string-tp24429876p24429876.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list