0

I have a series of data.frame like

  r t    
1 x 2

2 y 3

3 z 4

but I want to convert these three into time series, like

q = xts(as.matrix(data[1,]), order.by = "2011-09-28")
qq = xts(as.matrix(data[2,]), order.by = "2011-09-28")
qqq = xts(as.matrix(data[3,]), order.by = "2011-09-28")

My question is that since each time I only change rownames (1,2,3) and the names q qq qqq, may I sum them up into only one comment? like implement some functions?

joran
  • 169,992
  • 32
  • 429
  • 468
Eva
  • 917
  • 4
  • 18
  • 23

1 Answers1

1
df=data.frame(list(r=c("x","y","z"),t=c(2,3,4)))
dfx=as.xts(df,order.by=rep(as.POSIXct("2011-09-28"),nrow(df)))
Shadi
  • 26
  • 1