cs_collapse | R Documentation |
This function takes a year-list containing individual tibbles - one per month - that have been validated and collapses them into a single tibble.
cs_collapse(.data)
.data |
A list containing monthly crime data |
cs_collapse
applies common sense variable classes to a number
of variables. This is motivated by issues that originate with SLMPD .csv
files. When they are imported, the readr package sometimes applies
the incorrect variable classes because of formatting issues in the tables.
Since the tables have inconsistent variable names and numbers of variables,
all variables are imported as chr
data. During cs_collapse
's
execution, the following changes are made:
Converted to int
Converted to int
Converted to int
Converted to int
Converted to int
Converted to int
Converted to dbl
Converted to dbl
A tibble containing all crime data in a given year-list object.
# load example year-list object
load(system.file("testdata", "yearList17.rda", package = "compstatr", mustWork = TRUE))
# validate
cs_validate(yearList17, year = 2017)
# standaridze May, which has 26 variables
yearList17 <- cs_standardize(yearList17, month = "May", config = 26)
# validate again to confirm fix
cs_validate(yearList17, year = 2017)
# collapse now that the data are valid
crimeReports17 <- cs_collapse(yearList17)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.