insert_labels: Insert labels in factor variables (in portuguese).

Description Usage Arguments Details Value Examples

View source: R/functions.R

Description

The dictionary used to label is from 2019 data

Usage

1
2
3
4
5
6
insert_labels(
  file_path_origin,
  file_path_destiny,
  data_level = c("Escola", "Docente", "Gestor", "Turma", "Matricula"),
  add_variables = TRUE
)

Arguments

file_path_origin

character, path to .rda file generated by function import_csv2rda()

file_path_destiny

character, path to .rda file to be created, with labels in factors

data_level

character, defines census data level according to data file imported ('Escola','Docente','Gestor','Turma','Matricula')

add_variables

logical, if TRUE add some useful variables to the data.frame

Details

Works fine with 2019 data, and at least partially with 2015 data. Other years not tested yet.

Value

data.frame saved in .rda file

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
# you must first download the .zip file. See ?download_microdata
# then you must unzip it and choose a data file (eg. ESCOLA.CSV)
# then you can run the code below, changing the first 3 lines as you wish
# note that 'data_level' must also be defined, in function insert_labels()

## Not run: 
file.downloaded='~/YOUR_PATH/downloaded_data/ESCOLA.CSV'
file.imported='~/YOUR_PATH/temp_data.rda'
file.labelled='~/YOUR_PATH/censusData_ESCOLA.rda'

import_csv2rda(file_path_origin=file.downloaded,
              file_path_destiny=file.imported)

insert_labels (file_path_origin=file.imported,
              file_path_destiny=file.labelled,
              data_level='Escola',
              add_variables=TRUE)
## End(Not run)

travitzki/BRschoolData documentation built on Dec. 31, 2020, 8:45 a.m.