You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There's slightly different behavior between "matrix" and xts/zoo when it comes to subset and subset-assignment calls that only specify i. For example, using the data from a stack overflow question:
Consider the behavior of each class if only i is specified when subsetting. The matrix object returns the first element, while both the xts and zoo objects return all the columns for the first row.
Now compare the 3 classes' behavior when assigning a new row to a subset when only i is provided:
m1[1L] <-m2# Warning message:# In m1[1L] <- m2 :# number of items to replace is not a multiple of replacement lengthx1[1L] <-x2# Warning message:# In x1[1L] <- x2 :# number of items to replace is not a multiple of replacement lengthz1[1L] <-z2# Warning message:# In z1[1L] <- z2 :# number of items to replace is not a multiple of replacement length
They all warn, and none of the subset assignment calls alter the original object. The result isn't too surprising for matrix, since the subset call only returns one element. But it's a bit surprising for xts and zoo because the subset call returns the entire row, so it seems like you should be able to replace an entire row.
The text was updated successfully, but these errors were encountered:
There's slightly different behavior between "matrix" and xts/zoo when it comes to subset and subset-assignment calls that only specify
i
. For example, using the data from a stack overflow question:Consider the behavior of each class if only
i
is specified when subsetting. The matrix object returns the first element, while both the xts and zoo objects return all the columns for the first row.Now compare the 3 classes' behavior when assigning a new row to a subset when only
i
is provided:They all warn, and none of the subset assignment calls alter the original object. The result isn't too surprising for matrix, since the subset call only returns one element. But it's a bit surprising for xts and zoo because the subset call returns the entire row, so it seems like you should be able to replace an entire row.
The text was updated successfully, but these errors were encountered: