separate_year_groups: Separate Year Groups

Description Usage Arguments See Also Examples

View source: R/year.R

Description

Separates a column containing year groups, such as "1983-1985", into two separate columns named year_min and year_max by default.

Usage

1
2
separate_year_groups(data, year_group = year_group,
  into = c("year_min", "year_max"), sep = "-")

Arguments

data

A data frame

year_group

The unquoted column containing the year_group.

into

The names of the min year and max year columns (respectively) into which the minimum and maximum year from year_group are added. Set to NULL to use the year_group column name as a prefix with _min and _max appended.

sep

Characters separating years in year. Whitespace on either side of sep will be automatically removed. Passed to tidyr::separate().

See Also

Other year processors: add_mid_year_groups, complete_year_groups

Examples

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_group = year_groups) %>%
  separate_year_groups()

GerkeLab/fcds documentation built on July 30, 2020, 7:04 p.m.