Access 'RAIS' Microdata from the Brazilian Ministry of Labour
Overview
Download and read the public, non-identified microdata of the 'RAIS' (Relação Anual de Informações Sociais), the annual census of formal employment relationships and establishments published by the Brazilian Ministry of Labour and Employment through the 'PDET' FTP server <ftp://ftp.mtps.gov.br/pdet/microdados/RAIS/>. Lists the years and archives available on the server, resolves which regional or state archive holds a given state, downloads it with an idempotent local cache, and reads the '7z' archives as a stream, filtering by state and selecting columns before anything is kept in memory, so that a single state can be extracted from a regional file of tens of millions of records. Handles the two header generations of the files (up to the 'RAIS' 2022 and from the 'RAIS' 2023 onwards) with the same normalized column names, provides the official record layout and a helper to consolidate the employment stock, admissions, separations and December payroll.
Initial release.
rais_available()lists every archive published on the PDET/MTE FTP server, with size, modification date and edition (final, partial, legacy).rais_files()resolves offline which archive holds a state in a year (one file per state up to 2017, regional files from 2018) andrais_ufs()gives the state table behind it.rais_download()fetches the archives into an idempotent local cache that mirrors the server layout (rais_cache_dir(),rais_cache_list(),rais_cache_clear()).rais_read()stream-reads a.7zarchive, filtering by state and selecting columns chunk by chunk, detecting the file generation (;with decimal comma up to the RAIS 2022,,with decimal point from the RAIS 2023) and mapping both to the same normalized column names;rais_fetch()combines download and read for several years.
Show all changes in 0.1.0Hide the rest of the changes in 0.1.0
rais_stock()consolidates the stock on 31 December, admissions, separations and December payroll by any grouping.rais_layout()documents the columns of the employment and establishment files, with the two header spellings of each.- Sample archives in
inst/extdata(both generations, employment and establishments, plus a pre-2018 state file) allow every reading function to be tried offline.
From NEWS.md in the release
Install
Health
- OK13 OKNow
- OK6 OK2026-09-30
Documentation
- Help pages
- 12 (1 internal)includes a package overview page
- Examples that run
- 82%9 run in a plain check · 1 only when donttest examples are enabled (R CMD check --as-cran) · 1 never run
- Exported functions with examples
- 100%
- Documented parameters
- 100%
- Return-value docs
- 100%
- Help pages citing references
- 0%
Downloads
Repository
9 development-tooling and community-health practices detected across 5 families in the upstream repository
Checks run against github.com/strategicprojects/raisr on 2026-10-22.
The R CMD check workflow runs on Linux, macOS and Windows, and on R-devel
GitHub Pages site last deployed 2026-09-29 · The repository has a site deploy workflow
pkgdown site last built 2026-09-29
Show all practicesHide 1 practice
This repository shows signs of AI coding tools.
- Claude Codefirst seen 2026-09-18Named in .Rbuildignore: CLAUDE.mdNamed in .gitignore: .claude, CLAUDE.mdCommits: at least 5 crediting it in the message
- Claude Fable 5.13 commits · Sep 2026
- Claude Opus 5.52 commits · Sep 2026
Dependencies
Code & Tests
People & History
- 0.1.0Latest2026-09-29 · current release
- RR 4.6.0 released · 2026-04-24
Package metadata
- First published
- 2026-09-29
- Total releases
- 1 / 1 yrs
- License
- MIT + file LICENSE OSI
- Minimum R
- ≥ 4.1.0
- Download size
- 64 KB
Cite
Cite this package
Run in R for the authors' preferred citation:
citation("raisr")This package has no citation file, so citation() returns this entry built from DESCRIPTION.
Cite the R Observatory
For a number measured here: a download total, a coverage figure, an archival date.
From data release v2026-10-25, which the citation names so these numbers can be found later. More on citing and the projects behind them.