[Rd] write.table() fails for POSIXlt class and NAs in another variable (PR#3229)

ligges at statistik.uni-dortmund.de ligges at statistik.uni-dortmund.de
Wed Jun 11 10:16:06 MEST 2003


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.

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



More information about the R-devel mailing list