Giter Site home page Giter Site logo

brlabor's Introduction

brLabor

The goal of package “brLabor” is to extract data from the Brazilian Ministry of Labor and Social Security. At for this moment you can have access to the Annual National Social Recording (Relação Anual de Trabalhadores - rais), to Colective agreements between workers and companies’ unions, as well as labor accidents.

Installation

You can install trabalho from github with:

# install.packages("devtools")
devtools::install_github("jjesusfilho/brLabor")

Rais data

In order to extract rais data, you use the rais function. To use this function, you first need to install the archive package.

You can download the rais data from several states and also include more than one CNAE or CBO. As for the year, the function only allows one year at a time. It will download the file in 7-zip format, then decompress it to a txt file, and finally read the data into R in chunks of 1000 lines each time. After that, it will remove the files from the directory. You need at least 9Gb of free space in your HD if you want to extract the rais of São Paulo.

As for the CNAE and CBO, smaller numbers will download more classes. First example, if you want to extract ocupations from high ranks of the tree branches, like judges, mayors and senators, you put CBO=“111”. The same with the CNAE.

Example.

df<-rais(uf=c("SP","RJ"),CNAE="84","111")

The description of each variable can be accessed through the following data:

data(dic)

So the CBO number corresponds to variable X8. To find the occupation’s descriptions, you have to access the CBO data:

data(cbo)

After that, you can replace the numbers with their respective descriptions. There is a function from the miscBR package that does the work for you. The first argument is the column to be replaced, the second one is the column from the second data.frame to find matches and the third argument is the replacement that comes from the second data.frame:

devtools::install_github("jjesusfilho/miscBR")
df$X8<-miscBR::subs(df$X8,cbo$cbo,cbo$desc)

brlabor's People

Contributors

jjesusfilho avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.