Re: [R] Problem with ddply in the plyr-package: surprising output of a date-column

From: Hadley Wickham <hadley_at_rice.edu>
Date: Mon, 25 Apr 2011 15:07:41 -0500

> If you need plyr for other tasks you ought to use a different
> class for your date data (or wait until plyr can deal with
> POSIXlt objects).

How do you get POSIXlt objects into a data frame?

> df <- data.frame(x = as.POSIXlt(as.Date(c("2008-01-01"))))
> str(df)

'data.frame': 1 obs. of 1 variable:
 $ x: POSIXct, format: "2008-01-01"

> df <- data.frame(x = I(as.POSIXlt(as.Date(c("2008-01-01")))))
> str(df)

'data.frame': 1 obs. of 1 variable:
 $ x: AsIs, format: "0"

Hadley

-- 
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/

______________________________________________
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.
Received on Mon 25 Apr 2011 - 20:10:08 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 25 Apr 2011 - 21:40:34 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive