Grokbase Groups R r-devel March 2011
FAQ
Currently, if you call write.table() on a data.frame that includes a POSIXlt or POSIXct variable, with the default options (space delimited), you won't then be able to read that file back in using read.table because the POSIXlt and POSIXct won't get quoted, and they contain a space in them when written to the file.

For an example, see:
https://gist.github.com/881799

A one line change to write.table() to quote POSIXlt and POSIXct by default can fix this:

if (qset)
quote <- if (length(x))
which(unlist(lapply(x, function(x) is.character(x) ||
- is.factor(x))))
+ is.factor(x) || is(x, "POSIXlt") || is(x, "POSIXct"))))
else numeric(0L)

I get all the theoretical reasons for why this shouldn't be a big deal (I could use read.csv and write.csv instead of read.table and write.table, or convert to character before writing if I was set on using write.table), but this is the sort of thing that just confuses people with limited upside. I can't think of a way in which this change would break anyone's legacy code.

Best,
Noah

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 1 | next ›
Discussion Overview
groupr-devel @
categoriesr
postedMar 22, '11 at 7:45p
activeMar 22, '11 at 7:45p
posts1
users1
websiter-project.org
irc#r

1 user in discussion

Noah Lorang: 1 post

People

Translate

site design / logo © 2022 Grokbase