# NOT RUN {
# load example year-list objects
load(system.file("testdata", "yearList17.rda", package = "compstatr", mustWork = TRUE))
load(system.file("testdata", "yearList18.rda", package = "compstatr", mustWork = TRUE))
# validate
cs_validate(yearList17, year = 2017)
cs_validate(yearList18, year = 2018)
# standaridze May for the 2017 object, 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)
crimeReports18 <- cs_collapse(yearList18)
# combine to add all sample 2017 crimes reported in 2018 to a single 2017 object
# and remove from our 2017 object all sample crimes reported in 2017 that occured prior
# to that year
crime17 <- cs_combine(type = "year", date = 2017, crimeReports17, crimeReports18)
# }
Run the code above in your browser using DataLab