df_col_dt_format {oaii} | R Documentation |
Replace unix timestamp column(s) to formated dt string
Description
Replace unix timestamp column(s) to formated dt string
Usage
df_col_dt_format(
df,
col,
format = "%Y-%m-%d %H:%M:%S",
tz = "",
on_missing_col = "warn"
)
Arguments
df |
data.frame, input data.frame |
col |
character vector, column names of the df that will be modified |
format |
A character string. The default for the |
tz |
A character string specifying the time zone to be used for
the conversion. System-specific (see |
on_missing_col |
string, behavior for missing column(s): "warn" - log warning, "skip" - skip missing column(s), "stop" - throw error |
Value
Modified input data.frame
Examples
df <- data.frame(
x = c("a", "b"),
dt = c(1687868601, 1688417643)
)
df_col_dt_format(df, "dt")
df_col_dt_format(df, "dt", "%H:%M")