split_datetimes: Splits date(time) column(s) into multiple columns
Description
These functions can split the "date" and "time" components of POSIXt columns
and the "hour", "month", and "day" components of Date columns into multiple
columns.
Usage
split_datetimes(data, cols = NULL, class = c("character", "date"))
split_dates(data, cols = NULL)
Value
a dataframe
Arguments
data
input dataframe
cols
set of columns to apply transformation to. If NULL will apply
to all POSIXt columns (for split_datetimes()) or Date columns (for
split_dates()).
class
For split_datetimes(). The desired output of the separate
"date" and "time" columns. "character" leaves the columns as character
vectors. "date" will reformat the date as a "Date" and the time as a
"POSIXct" object, with a dummy date appended to it. In split_dates(), all
returned columns are integers.
Author
Jack Davison
See Also
Other Messy date(time) functions:
messy_datetime_formats(),
messy_datetime_tzones()