read_caged_rds: Reads one or multiple .rds files with preprocessed CAGED data

Description Usage Arguments Details Value Examples

View source: R/read.R

Description

Loops through rds files containing dataframes with CAGED preprocessed data from a given month, reads them, and organizes data in a single dataframe.

Usage

1
2
3
4
5
6
7
8
read_caged_rds(
  data_folder,
  start,
  end,
  periodos_12meses = TRUE,
  nested = FALSE,
  stringAsFactors = TRUE
)

Arguments

data_folder

A character string indicating the directory where the rds files are located.

start

A character string indicating the month and year of the first month. Recommended format: YYYY-MM.

end

A character string indicating the month and year of the last month. Recommended format: YYYY-MM.

periodos_12meses

Logical. Can be set to TRUE only if multiples of 12 rds files are read. If TRUE, the resulting dataframe contains a column indicating the 12-month period each observation belongs to.

nested

Logical. Defaults to FALSE. If TRUE, the function returns a nested dataframe with a single row per rds file.

stringAsFactors

Logical.

Details

Note: rds files must be located inside the directory passed in the data_folder argument, and must be named in the following way: CAGED_YYYY_MM.rds.

Value

A dataframe.

Examples

1
2
3
4
5
6
## Not run: 
caged2012 <-
read_caged_rds(data_folder = 'caged_clean',
               start = '2012-01', end = '2012-12')

## End(Not run)

andremenegatti/cagedExplorer documentation built on July 1, 2020, 1:25 a.m.