dt_parts | R Documentation |
This function will take a datetime POSIXct vector and save the date, time, and timezone elements into their respective destination columns. This is intended to apply any corrections from datetime back to the original date, time, and timezone columns.
dt_parts(
df,
datetime_col = "datetime",
date_col = "Activity.Start.Date",
time_col = "Activity.Start.Time",
tz_col = "Activity.Start.End.Time.Zone",
comment_col = "Datetime.Comment",
tz_comment = "corrected timezone",
dst_comment = "corrected for DST",
tzdst_comment = "corrected timezone and for DST"
)
df |
Data frame to be evaluated. |
datetime_col |
Column name in df holding the POSIXct datetime values. Default is "datetime" |
date_col |
Destination column name in df holding the POSIXct date values. Default is "Activity.Start.Date" |
time_col |
Destination column name in df holding the POSIXct time values. Default is "Activity.Start.Time". |
tz_col |
Destination column name in df holding the timezone string values. Default is "Activity.Start.End.Time.Zone". |
comment_col |
Column name in df holding the comment column. Default is "Datetime.Comment". |
tz_comment |
Comment in string format to add to comment_col if the timezone changed. Default is "corrected timezone". |
dst_comment |
Comment in string format to add to comment_col if their was a time change. Default is "corrected for DST". |
tzdst_comment |
Comment in string format to add to comment_col if their was a timezone and time change. Default is "corrected timezone and for DST". |
The destination date_col and time_col are formatted as POSIXct values and are equal datetime_col. tz_col is formatted as a string. e.g. format(df$datetime_col, format="%Z").
A comparison is made between the value derived from datetime_col to the value in the destination column. If the values are different a comment is recorded in comment_col. Any existing comments are retained and new comments appended.
There are three different comments for three different situations: when only the timezone changes, when only the date/time changes, and when both the timezone and the date/time changes. A date/time change is usually due to adjustment for DST.
returned data frame.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.