cs_load_year: Create Year List Object

View source: R/create.R

cs_load_yearR Documentation

Create Year List Object

Description

cs_load_year is used to load a set of .csv files contained in the given directory. This should be used to load a full year worth of data or a partial year. There should be no more than 12 files in a given path, and all should correspond to the same year. All columns will be read in as character data in order to address inconsistencies in how the data are created. When cs_collapse is executed, variables will be converted numeric when doing so is applicable.

Usage

cs_load_year(path)

Arguments

path

A file path

Value

A year-list object containing 12 tibbles - one per month - worth of crime data stored within a list.

Examples

# create temporary directory
tmpdir <- tempdir()
fs::dir_create(paste0(tmpdir,"/data/"))

# load sample files into temporary directory
cs_example(path = paste0(tmpdir,"/data/"))

# prep sample files
cs_prep_year(path = paste0(tmpdir,"/data/"))

# load sample files
yearList17 <- cs_load_year(path = paste0(tmpdir,"/data/"))

# delete data
fs::dir_delete(paste0(tmpdir,"/data/"))

# print year-list object
yearList17


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