cs_load_year: Create Year List Object

Description Usage Arguments Value Examples

View source: R/create.R

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

1

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
# 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

compstatr documentation built on July 8, 2020, 7:34 p.m.