data <- read_mpath(
mpath_example("example_basic.csv"),
mpath_example("example_meta.csv")
)[1:10,]
# The most common use case for this function: Convert
# `timeStampStart` to datetime. Remember that these are in the
# local time zone, but R displays them as being in UTC.
timestamps_to_datetime(data$timeStampStart)
# Convert `timeStampStop` to datetime, but as being the correct
# value in UTC.
timestamps_to_datetime(
x = data$timeStampStop,
tz_offset = data$timeZoneOffset
)
# Let's convert `timeStampSent` to datetime, but this time we want to
# force the time zone to be in "America/New_York" as we know all
# participants were in this time zone and so we can link with other
# data that is also in New York's time zone.
timestamps_to_datetime(
x = data$timeStampSent,
force_tz = "America/New_York"
)
Run the code above in your browser using DataLab