【发布时间】:2011-07-17 13:54:53
【问题描述】:
以下在 R 中可以正常工作
myarray <- as.array(list(c(5,5), 9, c(4,2,2,4,6)))
mydf <- as.data.frame(myarray)
但在 Splus 中却没有——给出错误信息:
Problem in data.frameAux.list(x, na.strings = na.st..: arguments imply differing
number of rows: 2, 1, 5
Use traceback() to see the call stack
问:发生了什么事?我怎样才能让它在 Splus 中工作?
编辑:我应该更清楚地说明为什么我会经历这个将list 视为data.frame 的奇怪过程。这是因为我最终想在 Splus 中执行以下操作:
mypos <- timeSeq("1/1/08", "1/3/08", by = "days")
myts <- timeSeries(data = mydf, positions = mypos)
我想,目前最好的可行选择是建立一个类似的列表:
mytshack <- list(mypos, as.list(myarray))
但这很笨拙,如果可能的话,我想获得timeSeries 的功能
【问题讨论】:
标签: r time-series s-plus