[英]R how to convert the data.frame into time series one by one
I have a series of data.frame like 我有一系列的data.frame喜欢
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? 我的问题是,由于每次我只更改行名(1,2,3)和名称q qq qqq,我可以将它们汇总为一个注释吗? like implement some functions?
喜欢实现一些功能?
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)))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.