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
when I apply complete.cases() on it, it gives error message:
complete.cases(df)
Error in complete.cases(df) : not all arguments have the same length
It seems that complete.case() cannot handle the first column. I think it should give a warning message such as the class/type is not supported, instead of error message without any hints about the error.
version
_
platform x86_64-w64-mingw32
arch x86_64
os mingw32
system x86_64, mingw32
status
major 3
minor 2.3
year 2015
month 12
day 10
svn rev 69752
language R
version.string R version 3.2.3 (2015-12-10)
nickname Wooden Christmas-Tree
The problem here is that complete.cases doesn't use the R function length() to determine the length of the Time column, it uses the C macro LENGTH, which ignores the fact that Time is of class POSIXlt, and sees it as a length 11 list.
A workaround is to convert the time to POSIXct instead of POSIXlt.
It looks quite messy to fix this properly, so I'll just add a note to the documentation warning about the problem.
It actually looks pretty straightforward to translate the C code to R code which will pay attention to the classes. If that doesn't slow it down too much, I'll make that change.
I have a data frame:
1 2015-03-28 1
2 2015-03-28 1
3 2015-03-28 1
structure(list(Time = structure(list(sec = c(0, 0, 0), min = c(0L,
0L, 0L), hour = c(0L, 0L, 0L), mday = c(28L, 28L, 28L), mon = c(2L,
2L, 2L), year = c(115L, 115L, 115L), wday = c(6L, 6L, 6L), yday = c(86L,
86L, 86L), isdst = c(0L, 0L, 0L), zone = c("CST", "CST", "CST"
), gmtoff = c(NA_integer_, NA_integer_, NA_integer_)), .Names = c("sec",
"min", "hour", "mday", "mon", "year", "wday", "yday", "isdst",
"zone", "gmtoff"), class = c("POSIXlt", "POSIXt")), Treat = c(1L,
1L, 1L)), .Names = c("Time", "Treat"), row.names = c(NA, 3L), class = "data.frame")
when I apply complete.cases() on it, it gives error message:
Error in complete.cases(df) : not all arguments have the same length
It seems that complete.case() cannot handle the first column. I think it should give a warning message such as the class/type is not supported, instead of error message without any hints about the error.
platform x86_64-w64-mingw32
arch x86_64
os mingw32
system x86_64, mingw32
status
major 3
minor 2.3
year 2015
month 12
day 10
svn rev 69752
language R
version.string R version 3.2.3 (2015-12-10)
nickname Wooden Christmas-Tree
METADATA
The text was updated successfully, but these errors were encountered: