The following works fine in R
myarray <- as.array(list(c(5,5), 9, c(4,2,2,4,6)))
mydf <- as.data.frame(myarray)
But in Splus it does not---giving the error message:
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
Q: What's going on? How can I get this to work in Splus?
EDIT: I should make clearer why I'm going through this strange process of treating a list
as a data.frame
. It's because I'd eventually like to do something like the following in Splus:
mypos <- timeSeq("1/1/08", "1/3/08", by = "days")
myts <- timeSeries(data = mydf, positions = mypos)
The best feasible option right now, I guess, would be to build a list like:
mytshack <- list(mypos, as.list(myarray))
But this is clunky and I'd like to get the functionality of a timeSeries
if possible