ligges@statistik.uni-dortmund.de
2003-Jun-12 09:29 UTC
[Rd] Re: write.table() fails for POSIXlt class and NAs in another variable (PR#3242)
Uwe Ligges wrote:> Consider the following data.frame: > > > testdata > date nothing > 1 1991-12-31 NA > 2 1991-12-31 NA > > where date is of class POSIXlt. For easy reproducibility: > > "testdata" <- structure(list(date = structure(list(sec = c(0, 0), > min = c(0, 0), hour = c(0, 0), mday = c(31, 31), mon = c(11, 11), > year = c(91, 91), wday = c(2, 2), yday = c(364, 364), > isdst = c(0, 0)), .Names = c("sec", "min", "hour", "mday", "mon", > "year", "wday", "yday", "isdst"), class = c("POSIXt", "POSIXlt")), > nothing = c(NA, NA)), .Names = c("date", "nothing"), > row.names = c("1", "2"), class = "data.frame") > > > write.table() fails in this case: > > write.table(testdata, file="test.dat") > Error in as.matrix.data.frame(x) : dim<- length of dims do not match the > length of object > > and > > write.table(testdata[1,], file="test.dat") > Error in as.matrix.data.frame(x) : length of dimnames[2] not equal to > array extent > > I don't have the time to debug it right now, hence filing it as a bug > report.OK, after having spent a few minutes I do not have: The bug is obviously in as.matrix.data.frame() as the error message had told me (I should have seen this yesterday at once). I cannot really suggest anything, since some of the constructs within as.matrix.data.frame() seem to be rather strange. For sure, at least some of those are intended, but unfortunately the code lacks of comments. Uwe Ligges> Uwe Ligges > > _ > platform i386-pc-mingw32 > arch i386 > os mingw32 (Windows NT 4.0) > system i386, mingw32 > status Beta > major 1 > minor 7.1 > year 2003 > month 06 > day 11 > language R >
Possibly Parallel Threads
- Re: (PR#3241) write.table() fails for POSIXlt class and NAs in
- POSIXlt, POSIXct, strptime, GMT and 1969-12-31 23:59:59
- The presence/absence of `zone` in POSIXlt depending on time zone as a cause of possible inconsistences?
- Sys.timzone() returns NA - problem caused by as.POSIXlt? (PR#8003)
- The presence/absence of `zone` in POSIXlt depending on time zone as a cause of possible inconsistences?