Description Usage Arguments See Also Examples
Adds a new column containing the midpoint year of the range given in the
column indicated by the year_group
argument, in a new column named
according to the into
argument. The year
column is assumed to contain
a min year and a max year, separated by sep
. The midpoint is calculated
as floor((year_max - year_min) / 2)
unless offset
is explicitly provided.
1 2 | add_mid_year_groups(data, year_group = year_group, into = "year",
sep = "-", offset = NULL)
|
data |
A data frame |
year_group |
The unquoted column containing the |
into |
Character name of the column that will contain the mid year
exctracted from |
sep |
Characters separating years in |
offset |
If supplied, the number of years to be added to the lower bound
of the year group to calculate the mid-year value. By default uses
|
Other year processors: complete_year_groups
,
separate_year_groups
1 2 3 4 5 | year_groups <- c("1981-1985", "1986-1990", "1991-1995", "1996-2000",
"2001-2005", "2006-2010", "2011-2015")
dplyr::tibble(year = year_groups) %>%
add_mid_year_groups()
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.