[R] Time Zone query

David Winsemius dwinsemius at comcast.net
Sat Mar 14 16:34:32 CET 2009


Read this from the as.POSIXct help page more carefully:

"Usage
as.POSIXct(x, tz = "", ...)"

"tz
A timezone specification to be used for the conversion, if one is  
required. System-specific (see time zones), but "" is the current  
timezone, and "GMT" is UTC (Universal Time, Coordinated)."

-- 
David Winsemius


On Mar 14, 2009, at 9:52 AM, Neotropical bat risk assessments wrote:

> I am working with time-date data to plot temporal activity.
>
> I would like to create a "template" to repeat the date and time for  
> all potential data sets that may have differing time zone origins.
>
> Reading the > ?strptime help section I note that time zone is a  
> variable to add.
> Looking at the output of a sample data set
>  Species Location    Date Time
> 1 Sppaaa    One 1/13/2009 17:00
> 2 Sppaaa    One 1/13/2009 18:00
> 3 Sppaaa    One 1/13/2009 19:00
> 4 Sppaaa    One 1/13/2009 20:00
> 5 Sppaaa    One 1/13/2009 21:00...
>
> in order to understand how R is handling this and using:
>
> > All$Time <- as.POSIXct(strptime(as.character(d$Time), "%H:%M"))
> > All$Time
> [1] "2009-03-14 17:00:00 CST" "2009-03-14 18:00:00 CST"
> [3] "2009-03-14 19:00:00 CST" "2009-03-14 20:00:00 CST"
> [5] "2009-03-14 21:00:00 CST" "2009-03-14 22:00:00 CST"
>
> It appears that the default is using CST and this is I assume based  
> on my system setting for my PC time.
> Is there a way to NOT have it do this as the data I am processing  
> are from a different time zone.
>
> Tnx
>
> Bruce

David Winsemius, MD
Heritage Laboratories
West Hartford, CT




More information about the R-help mailing list