localize_to_time_zone: Localize time zone values

View source: R/timezone.R

localize_to_time_zoneR Documentation

Localize time zone values


localize_to_time_zone uses Google Maps Time Zone APIs to localize the time zone in an act_tbl. This modifies a mutated act_tbl with the time column updated to contain the same absolute time, but with the appropriate time zone for where the activity took place.





An act_tbl object.


Note that to avoid overuse of the APIs, this does an "approximation", in that it finds the correct time zone for the first point in the data frame, and assumes all points in that data frame use that time zone. Runs between time zones (or runs that cross daylight savings time shifts) will hence be recorded using a consistent, but not always pointwise correct, timezone.

Note that you must have previously called ggmap::register_google() to register an API key before calling this.


That same act_tbl, but with the time column updated to be in the local time zone rather than UTC.


## Not run: 
example_gpx_file <- system.file(
  package = "activatr"
act_tbl <- parse_gpx(example_gpx_file)
act_tbl_with_tz <- localize_to_time_zone(act_tbl)

## End(Not run)

activatr documentation built on Aug. 22, 2023, 9:12 a.m.