View source: R/add_season_fct.R
add_season_fct | R Documentation |
Adds the four seasons DJF, SON, MAM, JJA as a factor (so to keep the annual order), with the option to define the first season (factor level). Requires that input data has column named "month", and adds a column named "season".
add_season_fct(ref_dat, first_season = "DJF", add_n_days = FALSE)
ref_dat |
a |
first_season |
character season, which should be the first level (default: "JJA") |
add_n_days |
logical; if T, adds the number of days in each season (of a non-leap year) |
Nothing, adds column by reference.
dat <- data.table::data.table(month = sample(1:12, 30, replace = TRUE))
add_season_fct(dat)
str(dat)
add_season_fct(dat, first_season = "JJA", add_n_days = TRUE)
str(dat)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.