[R] NROW doesn't equal length(x)
Muhammad Abuizzah
izzah100 at yahoo.com
Thu Oct 27 20:44:30 CEST 2011
Hi,
I am converting a data.frame to xts. the data.frame is 4 columns and 1000 rows. I get a message that "NROW (x) must match length(order.by)
class is data.frame, mode is list
when I run
dim(x) # I get
1000 4 #which is consistent with 1000 rows and 4 columns
NROW (x) # I get
1000 # which is the right answer
When I run length on each of columns in x separately using the "$" I get 1000, which is the right number too.
So length on each of the columns individually gives me the right answer, but length on the data.frame gives me the number of columns instead of the number of rows, is there an explanation
thanks
More information about the R-help
mailing list