NROW doesn't equal length(x)
Data frame is list internally so length(df) = ncol(df) M
On Oct 27, 2011, at 2:44 PM, Muhammad Abuizzah <izzah100 at yahoo.com> wrote:
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
______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.