cs_extract_month: Extract Month from Year List Object

View source: R/month_tools.R

cs_extract_monthR Documentation

Extract Month from Year List Object

Description

This function extracts a given month from a list containing 12 tibbles - one per month - for additional data cleaning prior to collapsing the list. Since months are ordered alphabetically in the year list objects, this function makes the process of extracting a particular month more intuitive.

Usage

cs_extract_month(.data, month)

Arguments

.data

A list containing monthly crime data

month

A string name or abbreviation of a month, or its numeric value. Acceptable inputs include, for example, "January", "january", "Jan", "jan", and 1.

Value

A tibble containing a single month worth of crime data.

See Also

cs_replace_month

Examples

# load example year-list object
load(system.file("testdata", "yearList17.rda", package = "compstatr", mustWork = TRUE))

# extract May
may17 <- cs_extract_month(yearList17, month = 5)
may17 <- cs_extract_month(yearList17, month = "May")


chris-prener/compStatR documentation built on Jan. 25, 2024, 10:03 p.m.