[R] POSIXlt vs POSIXct

Steven R Corsi srcorsi at usgs.gov
Thu Mar 29 22:05:50 CEST 2012


That is a good tip. I have tried it and found that it works if I make 
sure it was converted to character first. strptime appears to accept 
factor variables which is the default when reading in the file originally.

Thanks
Steve

On 3/29/2012 2:31 PM, MacQueen, Don wrote:
> I also find that POSIXct is generally the most useful, and only use
> POSIXlt in special cases.
>
> But have you considered as.POSIXct() instead of strptime()? It works for
> me, and I can't remember the last time I had to use strptime() for
> converting character to date/time. (But I mostly don't work with multiple
> time zones, except for converting to/from UTC.
>
> -Don
>



More information about the R-help mailing list