View source: R/add_month_fct.R
add_month_fct | R Documentation |
Adds the month abbreviations (Jan, Feb, ...) as a factor (so to keep the annual order), with the option to define the first month (as factor level), so also hydrological years are possible (Oct, Nov, Dec, Jan, ..). Requires that input data has either a "month" or "date" column, and adds a column named "month_fct".
add_month_fct(ref_dat, first_month = 1)
ref_dat |
a |
first_month |
numeric, month which should be the first level (default: 1, i.e. Jan) |
Nothing, adds column by reference.
dat <- data.table::data.table(month = sample(1:12, 30, replace = TRUE))
add_month_fct(dat)
str(dat)
add_month_fct(dat, 10)
summary(dat$month_fct)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.