| Title: | Download and Process Brazilian Education Data from INEP |
| Version: | 2.0.0 |
| Description: | Download and process public education data from INEP (Instituto Nacional de Estudos e Pesquisas Educacionais Anísio Teixeira). Provides functions to access microdata from the School Census (Censo Escolar), ENEM (Exame Nacional do Ensino Médio), SAEB (Sistema de Avaliação da Educação Básica), Higher Education Census (Censo da Educação Superior), ENADE (Exame Nacional de Desempenho dos Estudantes), ENCCEJA (Exame Nacional para Certificação de Competências de Jovens e Adultos), IDD (Indicador de Diferença entre os Desempenhos Observado e Esperado), CPC (Conceito Preliminar de Curso), IGC (Índice Geral de Cursos), CAPES graduate education data, FUNDEB (Fundo de Manutencao e Desenvolvimento da Educacao Basica), IDEB (Índice de Desenvolvimento da Educação Básica), and other educational datasets. Returns data in tidy format ready for analysis. Data source: INEP Open Data Portal https://www.gov.br/inep/pt-br/acesso-a-informacao/dados-abertos. |
| License: | MIT + file LICENSE |
| Encoding: | UTF-8 |
| URL: | https://github.com/SidneyBissoli/educabR, https://sidneybissoli.github.io/educabR/ |
| BugReports: | https://github.com/SidneyBissoli/educabR/issues |
| Depends: | R (≥ 4.1.0) |
| Imports: | cli, dplyr, httr2 (≥ 1.0.0), lifecycle, purrr, readr, rlang, stringi, stringr, tidyr, tools |
| Suggests: | ggplot2, jsonlite, kableExtra, knitr, readxl, rmarkdown, systemfonts, testthat (≥ 3.0.0), textshaping, tibble, withr |
| Config/testthat/edition: | 3 |
| VignetteBuilder: | knitr |
| Config/roxygen2/version: | 8.1.1 |
| NeedsCompilation: | no |
| Packaged: | 2026-11-03 22:23:01 UTC; SIDNEY |
| Author: | Sidney da Silva Pereira Bissoli
|
| Maintainer: | Sidney da Silva Pereira Bissoli <sbissoli76@gmail.com> |
| Repository: | CRAN |
| Date/Publication: | 2026-11-06 15:10:11 UTC |
educabR: Download and Process Brazilian Education Data from INEP
Description
Download and process public education data from INEP (Instituto Nacional de Estudos e Pesquisas Educacionais Anísio Teixeira). Provides functions to access microdata from the School Census (Censo Escolar), ENEM (Exame Nacional do Ensino Médio), SAEB (Sistema de Avaliação da Educação Básica), Higher Education Census (Censo da Educação Superior), ENADE (Exame Nacional de Desempenho dos Estudantes), ENCCEJA (Exame Nacional para Certificação de Competências de Jovens e Adultos), IDD (Indicador de Diferença entre os Desempenhos Observado e Esperado), CPC (Conceito Preliminar de Curso), IGC (Índice Geral de Cursos), CAPES graduate education data, FUNDEB (Fundo de Manutencao e Desenvolvimento da Educacao Basica), IDEB (Índice de Desenvolvimento da Educação Básica), and other educational datasets. Returns data in tidy format ready for analysis. Data source: INEP Open Data Portal https://www.gov.br/inep/pt-br/acesso-a-informacao/dados-abertos.
The educabR package provides functions to download and process public education data from INEP (Instituto Nacional de Estudos e Pesquisas Educacionais Anísio Teixeira). It offers easy access to microdata from:
-
School Census (Censo Escolar): Annual data on schools, enrollment, teachers, and classes in basic education
-
ENEM: Data from the National High School Exam
-
SAEB: Basic Education Assessment System (student performance)
-
Higher Education Census (Censo da Educação Superior): Annual data on institutions, courses, students, and faculty in higher education
-
ENADE: National Student Performance Exam (higher education)
-
IDD: Value-added indicator for undergraduate courses
-
CPC: Preliminary Course Concept (undergraduate quality indicator)
-
IGC: General Index of Courses (institutional quality indicator)
-
CAPES: Graduate education data (programs, students, faculty)
-
ENCCEJA: Youth and Adult Education Certification Exam
-
IDEB: Basic Education Development Index
All functions return data in tidy format, ready for analysis with tidyverse tools.
Main functions
School Census:
-
get_censo_escolar(): Download School Census microdata
ENEM:
-
get_enem(): Download ENEM microdata
SAEB:
-
get_saeb(): Download SAEB microdata
Higher Education Census:
-
get_censo_superior(): Download Higher Education Census microdata
ENEM por Escola:
-
get_enem_escola(): Download ENEM results aggregated by school
ENADE:
-
get_enade(): Download ENADE microdata
IDD:
-
get_idd(): Download IDD data
CPC:
-
get_cpc(): Download CPC data
IGC:
-
get_igc(): Download IGC data
CAPES:
-
get_capes(): Download CAPES graduate education data
ENCCEJA:
-
get_encceja(): Download ENCCEJA microdata
IDEB:
-
get_ideb(): Download IDEB data
Cache system
The package implements a local cache system to avoid repeated downloads.
Use set_cache_dir() to configure a persistent cache directory.
See get_cache_dir() to check the current cache location.
Package options
-
educabR.cache_dir: path to the cache directory. Set viaset_cache_dir()or directly withoptions(). Defaults tofile.path(tempdir(), "educabR_cache"). -
educabR.download_timeout: HTTP timeout in seconds fordownload_inep_file(). Defaults to600(10 minutes). Raise it for large microdata (e.g. ENEMparticipantesis ~1.6 GB) on slow connections:options(educabR.download_timeout = 1800).
Data source
Most data is downloaded from INEP's official portal: https://www.gov.br/inep/pt-br/acesso-a-informacao/dados-abertos/microdados
CAPES data is downloaded from the CAPES Open Data Portal: https://dadosabertos.capes.gov.br
Author(s)
Maintainer: Sidney da Silva Pereira Bissoli sbissoli76@gmail.com (ORCID)
Authors:
Sidney da Silva Pereira Bissoli sbissoli76@gmail.com (ORCID)
See Also
Useful links:
Report bugs at https://github.com/SidneyBissoli/educabR/issues
Identify an archive format from its first bytes
Description
Internal function. Returns "zip", "7z" or "rar" from the file
signature, or NA when none matches. Used instead of the extension,
which INEP does not always get right (IDD 2022 is a RAR named .zip).
Usage
archive_format(bytes)
Arguments
bytes |
A raw vector with the first bytes of the file (at least 6). |
Value
A string or NA_character_.
Fold text to ASCII the same way on every platform
Description
Internal function used to build column names and to compare sheet
names. iconv(to = "ASCII//TRANSLIT") is platform-dependent: macOS
turns "i-acute" into "'i", so names such as "Municipio" (with accent)
came out as munic_ipio there. This uses ICU's Latin-ASCII transform
and then reproduces the names educabR already produced on Windows:
ordinal indicators become letters ("N.o" -> "no"), superscript digits
become digits, and Greek letters and sharp s are dropped.
Usage
ascii_fold(x)
Arguments
x |
A character vector. |
Value
A character vector.
Check available years for a dataset
Description
Returns the years available for a given dataset. On the first call in a session, queries the data source to discover which years are actually available (requires internet). Results are cached for the session. Falls back to a known list if discovery fails.
Usage
available_years(dataset)
Arguments
dataset |
The dataset name. |
Value
An integer vector of available years.
Examples
## Not run:
available_years("enem")
available_years("enade")
available_years("fundeb_enrollment")
## End(Not run)
Stack the parts of an IGC table
Description
Internal function. Stacks the per-institution-type parts of an IGC table. Parts with the same number of columns take the column names of the first part, because INEP sometimes words the same header differently across sheets (IGC 2010: "Porcentagem de" in one sheet, "%" in the others). Otherwise parts are stacked by name. Columns whose type differs across parts are converted to character.
Usage
bind_igc_parts(parts)
Arguments
parts |
A list of data frames. |
Value
A tibble.
Build FUNDEB distribution URL from lookup table
Description
Internal function to construct the download URL for FUNDEB distribution data from STN. Uses a hardcoded lookup table of publication IDs.
Usage
build_fundeb_url(year)
Arguments
year |
The year. |
Value
A character string with the download URL.
Build IDEB download URL
Description
Internal function to construct IDEB download URLs based on level and stage.
Usage
build_ideb_url(level, stage, year)
Arguments
level |
Geographic level. |
stage |
Education stage. |
year |
The file year (most recent available). |
Value
A character string with the URL.
Build INEP microdata URL
Description
Internal function to construct URLs for INEP microdata.
Usage
build_inep_url(dataset, year, ...)
Arguments
dataset |
The dataset name (e.g., "censo_escolar", "enem"). |
year |
The year of the data. |
... |
Additional parameters for URL construction. |
Value
A character string with the URL.
Build SAEB ZIP filename
Description
Internal function to build the correct ZIP filename for SAEB data. Handles the special case of 2021 (split into two files).
Usage
build_saeb_zip_filename(year, level = "fundamental_medio")
Arguments
year |
The year. |
level |
The level (only relevant for 2021). |
Value
The ZIP filename.
Reference year of a CAPES resource
Description
Internal function. CAPES file names carry the reference year followed
by the publication date (br-capes-colsucup-prog-2017-2021-11-10.csv)
or, in the 2013-2016 packages, a range and a _YYYY suffix
(br-capes-btd-2013a2016-2017-12-01_2014.csv). Matching on "contains
the year" picked the wrong file there (every 2013-2016 name contains
"2016"), so the year is read from that structure.
Usage
capes_resource_year(x)
Arguments
x |
Resource names or URLs. |
Value
An integer vector (NA when no year is found).
Clean dash placeholder values
Description
Internal function to replace dash placeholders ("-", "\u2013") with
NA in all character columns. Common in INEP datasets where missing
values are encoded as dashes.
Usage
clean_dash_values(df)
Arguments
df |
A data frame. |
Value
The data frame with dashes replaced by NA.
Clean IDEB numeric columns
Description
Internal function to convert vl_* columns from character to numeric.
Handles "-" and "ND" as NA, and replaces comma decimal separators
with dots.
Usage
clean_ideb_values(df)
Arguments
df |
A data frame with IDEB data. |
Value
The data frame with vl_* columns as numeric.
Clear the educabR cache
Description
Removes all cached files from the educabR cache directory.
Usage
clear_cache(dataset = NULL)
Arguments
dataset |
Optional. A character string specifying which dataset
cache to clear. If |
Value
Invisibly returns TRUE if successful.
See Also
Other cache functions:
get_cache_dir(),
list_cache(),
set_cache_dir()
Examples
## Not run:
# clear all cached data
clear_cache()
# clear only ENEM cache
clear_cache("enem")
## End(Not run)
Resolve the source file of a Conceito Enade edition
Description
Internal function. Returns the URL, the sheet and the resolved type
for a year: the Conceito Enade spreadsheet, the combined Enade/CPC
table for 2007-2011, or one of the two 2025 files.
Usage
conceito_enade_source(year, type = NULL)
Arguments
year |
The year. |
type |
|
Value
A list with url, sheet and type.
Convert faixa and continuo columns to numeric
Description
Internal function to convert score columns (names ending in _faixa,
_faixas or _continuo) from character to numeric. Non-numeric
markers such as "SC" (Sem Conceito) and "sub judice" are converted
to NA. Stacking the sheets of the IGC 2007-2016 can turn these
columns into text when only one sheet carries such a marker.
Usage
convert_faixa_columns(df)
Arguments
df |
A data frame. |
Value
The data frame with score columns as numeric.
Detect file delimiter
Description
Internal function to detect the delimiter used in a CSV file by reading the first line and counting occurrences of common delimiters.
Usage
detect_delim(file)
Arguments
file |
Path to the data file. |
Value
The detected delimiter character.
Detect file encoding
Description
Internal function to detect the encoding of a text file. INEP files typically use Latin-1 or UTF-8.
Usage
detect_encoding(file, chunk_size = 4 * 1024^2)
Arguments
file |
Path to the file. |
Value
A character string with the encoding name.
Discover CAPES download URL via CKAN API
Description
Internal function to discover the download URL for a specific CAPES dataset and year using the CKAN API. CAPES URLs contain UUIDs and cannot be predicted, so they must be discovered dynamically.
Usage
discover_capes_url(year, type)
Arguments
year |
The year. |
type |
The data type. |
Value
A character string with the download URL.
Download a file from INEP
Description
Internal function to download files from INEP's servers with progress indication and error handling.
Usage
download_inep_file(url, destfile, quiet = FALSE)
Arguments
url |
The URL to download from. |
destfile |
The destination file path. |
quiet |
Logical. If |
Value
The path to the downloaded file.
Drop blank, footnote and total rows from a sheet read with readxl
Description
Internal function. INEP spreadsheets end with blank rows, footnotes written in the first column, or a lone total in one column (CPC 2022). A data row always fills several columns, so rows with at most one filled cell are dropped.
Usage
drop_footer_rows(df)
Arguments
df |
A data frame. |
Value
The data frame without those rows.
Drop an incomplete UTF-8 sequence at the end of a raw vector
Description
Internal function. A fixed-size chunk read from a UTF-8 file can cut a multibyte character. Only a trailing lead byte whose sequence is incomplete (with its continuation bytes) is dropped, so a latin1 byte at the end is kept and still makes the chunk invalid.
Usage
drop_incomplete_utf8_tail(bytes)
Arguments
bytes |
A raw vector. |
Value
The raw vector, possibly shorter.
Number of an ENADE data file
Description
Internal function. microdados2023_arq12.txt is file 12; a file without
an arq number counts as file 1.
Usage
enade_file_number(files)
Arguments
files |
File paths. |
Value
An integer vector.
Download and extract an ENADE edition
Description
Internal function shared by get_enade() and list_enade_files().
Usage
enade_prepare(year, keep_zip = TRUE, quiet = FALSE)
Arguments
year |
The year. |
keep_zip |
Logical. Keep the downloaded archive. |
quiet |
Logical. Suppress messages. |
Value
The extraction directory.
Summary statistics for ENEM scores
Description
Calculates summary statistics for ENEM scores, optionally grouped by demographic variables.
Usage
enem_summary(data, by = NULL)
Arguments
data |
A tibble with ENEM data (from |
by |
Optional grouping variable(s) as character vector. |
Value
A tibble with summary statistics for each score area.
See Also
Other ENEM functions:
get_enem(),
get_enem_escola(),
get_enem_itens()
Examples
## Not run:
enem <- get_enem(2023, n_max = 10000)
# overall summary
enem_summary(enem)
# summary by sex
enem_summary(enem, by = "tp_sexo")
## End(Not run)
Find how many title rows precede the header of an Excel sheet
Description
Internal function. Returns the number of rows to skip so that the header is the first row where at least half of the columns are filled. A sheet whose first row is already the header returns 0.
Usage
excel_header_skip(file, sheet = 1)
Arguments
file |
Path to the Excel file. |
sheet |
Sheet name or position. |
Value
An integer.
Extract an archive file (ZIP, 7z, or RAR)
Description
Internal function to extract archive files. Supports ZIP, 7z, and RAR
formats. For ZIP files, delegates to extract_zip(). For 7z and RAR
files, uses the system 7z command.
Usage
extract_archive(archive, exdir, quiet = FALSE)
Arguments
archive |
Path to the archive file. |
exdir |
Directory to extract to. |
quiet |
Logical. If |
Value
A character vector of extracted file paths.
Extract a ZIP file
Description
Internal function to extract ZIP files with progress indication.
utils::unzip() is tried first. Its zlib backend cannot decode some
entries INEP ships (Deflate64 compression, used for RESULTADOS_2025.csv
in the ENEM 2025 archive) and skips them with only a "zip file is corrupt"
warning, so the number of extracted files is compared with the archive's
listing. When anything is missing, the archive is extracted again with an
external tool (7-Zip, then PowerShell on Windows or unzip elsewhere),
and an error is raised if the archive is still incomplete.
Usage
extract_zip(zipfile, exdir, quiet = FALSE)
Arguments
zipfile |
Path to the ZIP file. |
exdir |
Directory to extract to. |
quiet |
Logical. If |
Value
A character vector of extracted file paths.
Fetch FUNDEB enrollment data from FNDE OData API
Description
Internal function to fetch FUNDEB enrollment data from FNDE's OData API with pagination support.
Usage
fetch_fundeb_enrollment(year, uf = NULL, n_max = Inf, quiet = FALSE)
Arguments
year |
The year. |
uf |
Optional UF code to filter at the API level. |
n_max |
Maximum number of rows to fetch. |
quiet |
Logical. If |
Value
A tibble with enrollment data.
Fetch the IDEB xlsx into cache
Description
Internal function to download the IDEB spreadsheet to xlsx_path. For
2023 and earlier, the URL points straight at the xlsx. From 2025 on,
INEP packages the xlsx inside a zip (alongside an ods copy and an md5
file); the zip is downloaded, the xlsx extracted into the cache, and
the zip and extraction leftovers removed.
Usage
fetch_ideb_file(url, xlsx_path, quiet = FALSE)
Arguments
url |
Download URL from |
xlsx_path |
Cache destination for the xlsx. |
quiet |
Logical. If |
Value
xlsx_path, invisibly.
Find the Censo Escolar main data file
Description
Internal function to locate the main data file within the extracted census directory.
Usage
find_censo_file(exdir, year)
Arguments
exdir |
The extraction directory. |
year |
The year. |
Value
The path to the data file.
Find a Censo Escolar file by user-supplied name
Description
Internal function to locate a specific CSV file within the extracted census directory by partial name match.
Usage
find_censo_file_by_name(exdir, file, year)
Arguments
exdir |
The extraction directory. |
file |
The file name or partial name to match. |
year |
The year (used in error messages). |
Value
The full path to the matched file.
Find the Higher Education Census data file
Description
Internal function to locate a Higher Education Census data file within the extracted directory based on the requested type.
Usage
find_censo_superior_file(exdir, year, type = "ies")
Arguments
exdir |
The extraction directory. |
year |
The year. |
type |
The data type ("ies", "cursos", "alunos", "docentes"). |
Value
The path to the data file.
Find data files in extracted directory
Description
Internal function to locate the main data files after extraction.
Usage
find_data_files(exdir, pattern = "\\.(csv|CSV|txt|TXT)$")
Arguments
exdir |
The extraction directory. |
pattern |
Optional regex pattern to filter files. |
Value
A character vector of file paths.
Find ENADE data files
Description
Internal function to locate all ENADE data files within the extracted
directory. INEP distributes ENADE microdata split across multiple files
(arq1.txt, arq2.txt, ...) that share the columns NU_ANO and
CO_CURSO but are sorted differently (they cannot be joined by row).
Usage
find_enade_files(exdir, year)
Arguments
exdir |
The extraction directory. |
year |
The year. |
Value
A character vector of file paths, sorted by split number.
Find the ENCCEJA data file
Description
Internal function to locate the ENCCEJA data file within the extracted directory.
Usage
find_encceja_file(exdir, year, type = "regular")
Arguments
exdir |
The extraction directory. |
year |
The year. |
type |
|
Details
Every published edition ships a regular file (REG_NAC or REGULAR)
and a PPL file (PPL_NAC or PPL), plus PPL questionnaire and item
files. The participant file is chosen by type, so the small PPL file is
never returned in place of the regular one. Layouts without either
marker fall back to the generic name patterns.
Value
The path to the data file.
Find the ENEM por Escola data file
Description
Internal function to locate the ENEM por Escola data file within the extracted directory.
Usage
find_enem_escola_file(exdir)
Arguments
exdir |
The extraction directory. |
Value
The path to the data file.
Find the ENEM data file
Description
Internal function to locate the main ENEM data file within the extracted directory.
Usage
find_enem_file(exdir, year, type = "participantes")
Arguments
exdir |
The extraction directory. |
year |
The year. |
type |
The data type ( |
Value
The path to the data file.
Find the IDD data file
Description
Internal function to locate the IDD data file within the extracted directory.
Usage
find_idd_file(exdir, year)
Arguments
exdir |
The extraction directory. |
year |
The year. |
Value
The path to the data file.
Find the per-grade SAEB student file
Description
Internal function that matches TS_ALUNO_<serie>.csv by exact name.
Usage
find_saeb_aluno_by_serie(exdir, year, serie = NULL)
Arguments
exdir |
The extraction directory. |
year |
The year. |
serie |
For |
Value
The path to the file, or NULL when the edition has no
per-grade student files.
Find the SAEB data file
Description
Internal function to locate a SAEB data file within the extracted directory based on the requested type.
Usage
find_saeb_file(exdir, year, type = "aluno", serie = NULL)
Arguments
exdir |
The extraction directory. |
year |
The year. |
type |
The data type ("aluno", "escola", "diretor", "professor", "secretario"). |
serie |
For |
Details
Since 2013 INEP ships one student file per grade (TS_ALUNO_2EF.csv,
TS_ALUNO_5EF.csv, ...). These are matched by exact name: with more than
one grade available and no serie, the function aborts listing the
grades instead of picking one silently.
Value
The path to the data file.
Fix brasil unnamed columns
Description
Internal function to rename columns in brasil data.
Usage
fix_brasil_cols(df)
Arguments
df |
Data frame with brasil data. |
Value
Data frame with renamed columns.
Fix regiao/estado unnamed columns and filter rows
Description
Internal function to rename unnamed columns in regiao_uf data and filter to keep only regions or states depending on the requested level.
Usage
fix_regiao_uf_cols(df, level)
Arguments
df |
Data frame with regiao_uf data. |
level |
|
Value
Data frame with renamed columns, filtered to the requested level.
Source name of a FUNDEB sheet
Description
Internal function. The sheet name is the destination prefix (E_ for
states, M_ for municipalities) followed by the source. The VAAF, VAAT
and VAAR shares of the Complementacao da Uniao (E_COUN_VAAF) keep the
short name ("VAAF"); every other sheet keeps its full suffix
(E_COUN -> "COUN", E_AFE_EC123 -> "AFE_EC123").
Usage
fundeb_sheet_source(sheet)
Arguments
sheet |
A sheet name. |
Value
A string.
Get the current cache directory
Description
Returns the current cache directory used by educabR.
Usage
get_cache_dir()
Value
A character string with the path to the cache directory.
See Also
Other cache functions:
clear_cache(),
list_cache(),
set_cache_dir()
Examples
get_cache_dir()
Get CAPES graduate education data
Description
Downloads and processes data from CAPES (Coordenacao de Aperfeicoamento de Pessoal de Nivel Superior) on Brazilian graduate programs (stricto sensu). Data is retrieved from the CAPES Open Data Portal via the CKAN API.
Usage
get_capes(
year,
type = c("programas", "discentes", "docentes", "cursos", "catalogo"),
n_max = Inf,
keep_file = TRUE,
quiet = FALSE
)
Arguments
year |
The year of the data (2013-2024). |
type |
The type of data to download. One of:
|
n_max |
Maximum number of rows to read. Default is |
keep_file |
Logical. If |
quiet |
Logical. If |
Details
CAPES is the federal agency responsible for evaluating and regulating graduate programs in Brazil. The data covers stricto sensu programs (master's and doctoral).
The data types include:
-
programas: Program identifiers, area, evaluation scores
-
discentes: Student enrollment, demographics, scholarship status
-
docentes: Faculty information, qualifications, employment
-
cursos: Course details, modality, start dates
-
catalogo: Catalog of theses and dissertations
Important notes:
Data is sourced from the CAPES Open Data Portal (CKAN), not INEP.
Files are large CSV files. Downloading may take several minutes.
Column names are standardized to lowercase with underscores.
Internet connection is required to discover download URLs via the CKAN API before downloading.
Value
A tibble with CAPES data in tidy format.
Data source
https://dadosabertos.capes.gov.br
Examples
## Not run:
# get graduate programs for 2023
programas <- get_capes(2023, type = "programas")
# get student data for 2022 with limited rows
discentes <- get_capes(2022, type = "discentes", n_max = 1000)
## End(Not run)
Get School Census (Censo Escolar) data
Description
Downloads and processes microdata from the Brazilian School Census (Censo Escolar), conducted annually by INEP. Returns school-level data with information about infrastructure, location, and administrative details.
Usage
get_censo_escolar(
year,
file = NULL,
uf = NULL,
n_max = Inf,
keep_zip = TRUE,
quiet = FALSE
)
Arguments
year |
The year of the census (1995-2025). |
file |
Optional. Name (or partial name) of a specific CSV file to load.
By default, loads the main school data file. Use
|
uf |
Optional. Filter by state (UF code or abbreviation). |
n_max |
Maximum number of rows to read. Default is |
keep_zip |
Logical. If |
quiet |
Logical. If |
Details
The School Census is the main statistical survey on basic education in Brazil. It collects data from all public and private schools offering basic education (early childhood, elementary, and high school).
Important notes:
The microdata contains one row per school (~217,000 schools in 2023).
Column names are standardized to lowercase with underscores.
Use the
ufparameter to filter by state for faster processing.Older years (1995-2006) contain multiple CSV files with different data. Use
list_censo_files()to discover available files, then pass the desired file name to thefileparameter.
Value
A tibble with school data in tidy format.
Data dictionary
For detailed information about variables, see INEP's documentation: https://www.gov.br/inep/pt-br/acesso-a-informacao/dados-abertos/microdados/censo-escolar
See Also
Other School Census functions:
list_censo_files()
Examples
## Not run:
# get schools data for 2023
escolas <- get_censo_escolar(2023)
# get schools from Sao Paulo state only
escolas_sp <- get_censo_escolar(2023, uf = "SP")
# read only first 1000 rows for exploration
escolas_sample <- get_censo_escolar(2023, n_max = 1000)
# list available files for an older year
list_censo_files(1995)
# [1] "CENSOESC_1995.CSV" "DADOS_DESP_1995.CSV" "DADOSCURSO_1995.CSV"
# load a specific file from an older year
cursos <- get_censo_escolar(1995, file = "DADOSCURSO")
# 2025: data is split into separate tables
list_censo_files(2025)
escolas_2025 <- get_censo_escolar(2025)
matriculas_2025 <- get_censo_escolar(2025, file = "Matricula")
docentes_2025 <- get_censo_escolar(2025, file = "Docente")
turmas_2025 <- get_censo_escolar(2025, file = "Turma")
## End(Not run)
Get Higher Education Census (Censo da Educação Superior) data
Description
Downloads and processes microdata from the Brazilian Higher Education Census (Censo da Educação Superior), conducted annually by INEP. Returns data on institutions, courses, students, or faculty.
Usage
get_censo_superior(
year,
type = c("ies", "cursos", "alunos", "docentes"),
uf = NULL,
n_max = Inf,
keep_zip = TRUE,
quiet = FALSE
)
Arguments
Details
The Higher Education Census is the most comprehensive statistical survey on higher education institutions (HEIs) in Brazil. It collects data from all HEIs offering undergraduate and graduate programs.
Data types:
-
"ies": One row per institution — administrative data, location, academic organization, funding type. -
"cursos": One row per undergraduate course — area of study, modality (in-person/distance), enrollment counts. -
"alunos": One row per student enrollment — demographics, program, admission type, enrollment status. -
"docentes": One row per faculty member — education level, employment type, teaching regime.
Important notes:
Student files (
"alunos") can be very large (several GB). Usen_maxto read a sample first.Column names are standardized to lowercase with underscores.
Use the
ufparameter to filter by state for faster processing.
Value
A tibble with Higher Education Census microdata in tidy format.
Data dictionary
For detailed information about variables, see INEP's documentation: https://www.gov.br/inep/pt-br/acesso-a-informacao/dados-abertos/microdados/censo-da-educacao-superior
See Also
Other Higher Education Census functions:
list_censo_superior_files()
Examples
## Not run:
# get institution data for 2023
ies <- get_censo_superior(2023)
# get course data for Sao Paulo
cursos_sp <- get_censo_superior(2023, type = "cursos", uf = "SP")
# get a sample of student data
alunos <- get_censo_superior(2023, type = "alunos", n_max = 10000)
# get faculty data
docentes <- get_censo_superior(2023, type = "docentes")
## End(Not run)
Get Conceito Enade data
Description
Downloads and processes the Conceito Enade spreadsheets published by INEP. The Conceito Enade is the course-level quality indicator derived from the performance of graduating students in ENADE, on a continuous scale and in five levels (faixas 1 to 5).
Unlike get_enade(), which returns student-level microdata, this
function returns one row per course (or per course unit, before 2015)
with the official indicator.
Usage
get_conceito_enade(
year,
type = NULL,
n_max = Inf,
keep_file = TRUE,
quiet = FALSE
)
Arguments
year |
The year of the indicator (2004-2019, 2021-2023, 2025). There is no 2020 edition (ENADE was not held) and no 2024 edition. |
type |
Only for 2025, which INEP publishes as two files with
their own methodology: |
n_max |
Maximum number of rows to read. Default is |
keep_file |
Logical. If |
quiet |
Logical. If |
Details
Unit of observation. Up to 2014 a row is a "course unit": all
courses of the same institution, municipality and evaluation area,
identified by the institution, municipality and area codes (the number
of courses grouped is in a column such as numero_de_cursos_da_unidade).
From 2015 on, a row is a course, identified by codigo_do_curso (the
e-MEC course code).
Sources by edition.
2004-2006 and 2012-2023: INEP's Conceito Enade spreadsheet.
2007-2011: INEP publishes the Conceito Enade inside the combined Enade/CPC table, so this function returns that table (the same one as
get_cpc()). The Conceito Enade is inconceito_enade(2007, 2008) orconceito_enade_faixa(2009-2011).2025: see
type. These files report the share of graduates at or above a proficiency standard and the faixa, with no continuous score.
Important notes:
Column names change across editions and are standardized to lowercase with underscores, not harmonized: map them to a common set before stacking years.
Faixa and continuous columns are numeric; "SC" (sem conceito) and similar markers become
NA.Files are in Excel format (xls/xlsx).
Value
A tibble with Conceito Enade data in tidy format.
Data dictionary
For detailed information about variables, see INEP's documentation: https://www.gov.br/inep/pt-br/areas-de-atuacao/pesquisas-estatisticas-e-indicadores/indicadores-de-qualidade-da-educacao-superior
See Also
Other CPC/IGC functions:
get_cpc(),
get_igc()
Examples
## Not run:
# Conceito Enade 2023
ce <- get_conceito_enade(2023)
# 2025 comes in two files
ce_lic <- get_conceito_enade(2025, type = "licenciaturas")
# a series: one call per year, then harmonize column names
series <- purrr::map(c(2017, 2018, 2019), get_conceito_enade)
## End(Not run)
Get CPC (Conceito Preliminar de Curso) data
Description
Downloads and processes CPC data from INEP. The CPC is a quality indicator for undergraduate courses in Brazil, composed of ENADE scores, IDD, faculty qualifications, pedagogical resources, and other institutional factors.
Usage
get_cpc(year, n_max = Inf, keep_file = TRUE, quiet = FALSE)
Arguments
year |
The year of the indicator (2007-2019, 2021-2023). Note: there is no 2020 edition. Years 2004-2006 used a different indicator ("Conceito Enade"). |
n_max |
Maximum number of rows to read. Default is |
keep_file |
Logical. If |
quiet |
Logical. If |
Details
CPC is calculated by INEP as part of the higher education quality assessment system (SINAES). It serves as a preliminary indicator used to determine which courses require on-site evaluation.
The data includes:
Course and institution identifiers
CPC scores (continuous and categorical/faixa)
Component scores (ENADE, IDD, faculty, infrastructure, etc.)
Number of students evaluated
Important notes:
CPC follows ENADE's rotating cycle of course areas, so each year covers a specific set of fields.
There is no 2020 edition (COVID-19 suspension).
Column names are standardized to lowercase with underscores.
Files are in Excel format (xls/xlsx), not CSV.
Value
A tibble with CPC data in tidy format.
Data dictionary
For detailed information about variables, see INEP's documentation: https://www.gov.br/inep/pt-br/areas-de-atuacao/pesquisas-estatisticas-e-indicadores/indicadores-de-qualidade-da-educacao-superior
See Also
Other CPC/IGC functions:
get_conceito_enade(),
get_igc()
Examples
## Not run:
# get CPC data for 2023
cpc <- get_cpc(2023)
# get CPC data for 2021 with limited rows
cpc_2021 <- get_cpc(2021, n_max = 1000)
## End(Not run)
Get ENADE (Exame Nacional de Desempenho dos Estudantes) data
Description
Downloads and processes microdata from ENADE, the Brazilian National Student Performance Exam. ENADE evaluates the performance of undergraduate students in higher education.
Every edition is published as several files (arq1, arq2, ...), each
with one group of variables. The files cannot be joined student by
student: to comply with the LGPD, INEP sorts each file by different
variables, so the first row of one file is not the same student as the
first row of another. get_enade() therefore reads one file per call;
use list_enade_files() to see which variables each file holds.
Usage
get_enade(year, arquivo = NULL, n_max = Inf, keep_zip = TRUE, quiet = FALSE)
Arguments
year |
The year of the exam (2004-2019, 2021-2023). |
arquivo |
The file to read: the number in its name
( |
n_max |
Maximum number of rows to read. Default is |
keep_zip |
Logical. If |
quiet |
Logical. If |
Details
ENADE is conducted annually by INEP and evaluates undergraduate students nearing the end of their programs. Each year, a different set of course areas is assessed on a rotating cycle (typically every 3 years per area).
Every file carries nu_ano and co_curso, so files can be combined at
the course level (for example, averages by co_curso), as INEP's user
manual recommends. Combining them row by row produces records that mix
different students; up to educabR 1.2.0, get_enade() did exactly that.
Student-level linkage is only available through INEP's protected data
service (Sedap).
Important notes:
Use
n_maxto read a sample first for exploration.Column names are standardized to lowercase with underscores.
Not all course areas are assessed every year due to the rotating cycle.
The numbering of files can skip numbers (2013 has no
arq3).
Value
A tibble with the microdata of one ENADE file.
Data dictionary
Each edition ships a dictionary of files and variables
(Dicionario_arquivos_variaveis_microdados_Enade_<year>.xlsx) in the
downloaded archive. See also INEP's documentation:
https://www.gov.br/inep/pt-br/acesso-a-informacao/dados-abertos/microdados/enade
See Also
Other ENADE functions:
list_enade_files()
Examples
## Not run:
# which variables are in which file?
list_enade_files(2023)
# read one file
arq3 <- get_enade(2023, arquivo = 3)
# combine files at the course level (co_curso), never row by row
scores <- get_enade(2023, arquivo = 3)
by_course <- aggregate(nt_ger ~ co_curso, data = scores, FUN = mean)
## End(Not run)
Get ENCCEJA (Exame Nacional para Certificação de Competências de Jovens e Adultos) data
Description
Downloads and processes microdata from ENCCEJA, the Brazilian National Exam for Youth and Adult Education Certification. ENCCEJA assesses competencies of young people and adults who did not complete basic education at the regular age.
Usage
get_encceja(
year,
type = c("regular", "ppl"),
n_max = Inf,
keep_zip = TRUE,
quiet = FALSE
)
Arguments
year |
The year of the exam (2014, 2017-2020, 2022-2025; INEP published no microdata for 2015, 2016 and 2021). |
type |
Which participants to load. INEP ships two microdata files per edition:
|
n_max |
Maximum number of rows to read. Default is |
keep_zip |
Logical. If |
quiet |
Logical. If |
Details
ENCCEJA is conducted by INEP and provides certification for elementary and high school equivalency for youth and adults (EJA). The exam covers four knowledge areas:
Natural Sciences (Ciências Naturais)
Mathematics (Matemática)
Portuguese Language (Língua Portuguesa)
Social Sciences (Ciências Humanas)
Important notes:
ENCCEJA files can be large (several hundred MB).
Use
n_maxto read a sample first for exploration.Column names are standardized to lowercase with underscores.
Value
A tibble with ENCCEJA microdata in tidy format.
Data dictionary
For detailed information about variables, see INEP's documentation: https://www.gov.br/inep/pt-br/acesso-a-informacao/dados-abertos/microdados/encceja
Examples
## Not run:
# get ENCCEJA data for 2023
encceja <- get_encceja(2023, n_max = 10000)
# get full dataset for 2022
encceja_2022 <- get_encceja(2022)
# participants deprived of liberty (PPL)
encceja_ppl <- get_encceja(2023, type = "ppl")
## End(Not run)
Get ENEM (Exame Nacional do Ensino Médio) data
Description
Downloads and processes microdata from ENEM, the Brazilian National High School Exam. ENEM is used for university admissions and as a high school equivalency exam.
Usage
get_enem(
year,
type = "participantes",
n_max = Inf,
keep_zip = TRUE,
quiet = FALSE
)
Arguments
year |
The year of the exam (1998-2025). |
type |
Type of data to load. Only used for ENEM 2024+, where
microdata is split into separate files. Options: |
n_max |
Maximum number of rows to read. Default is |
keep_zip |
Logical. If |
quiet |
Logical. If |
Details
ENEM is conducted annually by INEP and is the largest exam in Brazil, with millions of participants. The microdata includes:
Participant demographics (age, sex, race, etc.)
Socioeconomic questionnaire responses
Scores for each test area
Essay scores
School information (when applicable)
Important notes:
ENEM files are very large (several GB when extracted).
Use
n_maxto read a sample first for exploration.Column names are standardized to lowercase with underscores.
Score variables start with
nu_nota_prefix.From 2024 onwards, INEP split the microdata into separate files. Use the
typeparameter to choose which file to load.
Value
A tibble with the ENEM microdata in tidy format.
Data dictionary
For detailed information about variables, see INEP's documentation: https://www.gov.br/inep/pt-br/acesso-a-informacao/dados-abertos/microdados/enem
See Also
Other ENEM functions:
enem_summary(),
get_enem_escola(),
get_enem_itens()
Examples
## Not run:
# get a sample of 10000 rows for exploration
enem_sample <- get_enem(2023, n_max = 10000)
# get full data (warning: large file)
enem_2023 <- get_enem(2023)
# ENEM 2024+: choose data type
participantes <- get_enem(2024, type = "participantes", n_max = 1000)
resultados <- get_enem(2024, type = "resultados", n_max = 1000)
## End(Not run)
Get ENEM por Escola (ENEM by School) data
Description
Downloads and processes ENEM results aggregated by school. This dataset contains average ENEM scores, participation rates, and other indicators for each school in Brazil.
Usage
get_enem_escola(n_max = Inf, keep_zip = TRUE, quiet = FALSE)
Arguments
n_max |
Maximum number of rows to read. Default is |
keep_zip |
Logical. If |
quiet |
Logical. If |
Details
ENEM por Escola is a single bundled dataset covering years 2005 to 2015. It was discontinued by INEP after 2015 and no per-year files exist.
The data includes:
School identification (code, name, municipality, state)
Average ENEM scores by knowledge area
Number of participants and participation rates
School-level indicators
Important notes:
This is a single file covering all years (2005-2015), not per-year.
Column names are standardized to lowercase with underscores.
Data was discontinued after 2015.
Value
A tibble with ENEM by School data in tidy format.
Data dictionary
For detailed information about variables, see INEP's documentation: https://www.gov.br/inep/pt-br/acesso-a-informacao/dados-abertos/microdados/enem-por-escola
See Also
Other ENEM functions:
enem_summary(),
get_enem(),
get_enem_itens()
Examples
## Not run:
# get all ENEM by School data (2005-2015)
enem_escola <- get_enem_escola()
# read only first 1000 rows for exploration
enem_escola_sample <- get_enem_escola(n_max = 1000)
## End(Not run)
Get ENEM item response data
Description
Downloads and processes ENEM item response (gabarito) data, which contains detailed information about each question.
Usage
get_enem_itens(year, n_max = Inf, keep_zip = TRUE, quiet = FALSE)
Arguments
year |
The year of the exam (1998-2025). |
n_max |
Maximum number of rows to read. |
keep_zip |
Logical. If |
quiet |
Logical. If |
Value
A tibble with item response data.
See Also
Other ENEM functions:
enem_summary(),
get_enem(),
get_enem_escola()
Examples
## Not run:
# get item data for 2023
itens <- get_enem_itens(2023)
## End(Not run)
Get FUNDEB distribution data
Description
Downloads and processes FUNDEB resource distribution data from STN (Secretaria do Tesouro Nacional). Each year's Excel file contains multiple sheets with monthly transfer data by state/municipality, broken down by funding source.
Usage
get_fundeb_distribution(
year,
uf = NULL,
source = NULL,
destination = NULL,
n_max = Inf,
keep_file = TRUE,
quiet = FALSE
)
Arguments
year |
The year of the data (2007-2026). |
uf |
Optional. A UF code (e.g., |
source |
Optional. The funding source to filter by. One of:
|
destination |
Optional. The transfer destination. One of:
Default is |
n_max |
Maximum number of rows to return. Default is |
keep_file |
Logical. If |
quiet |
Logical. If |
Details
FUNDEB (Fundo de Manutencao e Desenvolvimento da Educacao Basica e de Valorizacao dos Profissionais da Educacao) is the main funding mechanism for basic education in Brazil.
Each Excel file from STN contains ~20 data sheets named with a prefix
indicating the destination (E_ for states, M_ for municipalities)
and a suffix indicating the funding source (e.g., E_FPE, M_ICMS).
Each sheet contains two tables: the main FUNDEB transfers and a
FUNDEB adjustment table.
Important notes:
Data is sourced from STN (Tesouro Nacional), not INEP.
Files are in Excel format (XLS) — requires the
readxlpackage.Column names are standardized to lowercase with underscores.
Summary sheets (Resumo, Total, etc.) are automatically excluded; every other sheet is read, so the sum of
valorover all sources equals STN's TOTAL sheet.From 2021 on, the Complementacao da Uniao comes in VAAF, VAAT and VAAR shares (sources
"VAAF","VAAT","VAAR"); up to 2020 it is a single source,"COUN".
Value
A tibble in tidy (long) format with columns:
- estados
State name
- uf
State code (UF)
- mes_ano
Date (last day of the month)
- origem
Funding source (FPE, FPM, ICMS, etc.)
- destino
Transfer destination ("UF" or "Municipio")
- tabela
Table type ("Fundeb" or "Ajuste Fundeb")
- valor
Transfer amount in BRL (numeric)
Data source
https://www.tesourotransparente.gov.br
See Also
Other FUNDEB functions:
get_fundeb_enrollment()
Examples
## Not run:
# get all FUNDEB distribution data for 2023
dist_2023 <- get_fundeb_distribution(2023)
# get only FPE transfers to states
fpe_estados <- get_fundeb_distribution(2023, source = "FPE",
destination = "uf")
# get data for Sao Paulo only
sp <- get_fundeb_distribution(2023, uf = "SP")
## End(Not run)
Get FUNDEB enrollment data
Description
Downloads and processes FUNDEB enrollment data from FNDE's OData API. These are the enrollment counts considered for FUNDEB funding calculation.
Usage
get_fundeb_enrollment(
year,
uf = NULL,
n_max = Inf,
keep_file = TRUE,
quiet = FALSE
)
Arguments
year |
The year of the data (2007-2026). |
uf |
Optional. A UF code (e.g., |
n_max |
Maximum number of rows to read. Default is |
keep_file |
Logical. If |
quiet |
Logical. If |
Details
Enrollment data comes from FNDE (Fundo Nacional de Desenvolvimento da Educacao) via its OData API. It includes the number of enrollments considered for FUNDEB funding, broken down by state, municipality, education type, school network, class type, and location.
Important notes:
Data is sourced from FNDE, not INEP.
Requires the
jsonlitepackage.Results are cached locally as CSV after first download.
Column names are standardized to lowercase with underscores.
When
ufis used with a cached file, filtering is done locally.
Value
A tibble with columns:
- ano_censo
Census year
- uf
State code (UF)
- municipio
Municipality name
- tipo_rede_educacao
Education network type
- descricao_tipo_educacao
Education type description
- descricao_tipo_ensino
Teaching type description
- descricao_tipo_turma
Class type description
- descricao_tipo_carga_horaria
Class hours type description
- descricao_tipo_localizacao
Location type description
- qtd_matricula
Number of enrollments
Data source
FNDE: https://www.fnde.gov.br
See Also
Other FUNDEB functions:
get_fundeb_distribution()
Examples
## Not run:
# get FUNDEB enrollment data for 2023
mat_2023 <- get_fundeb_enrollment(2023)
# get enrollment data for Sao Paulo only
mat_sp <- get_fundeb_enrollment(2023, uf = "SP")
# get enrollment data with limited rows
mat_sample <- get_fundeb_enrollment(2023, n_max = 1000)
## End(Not run)
Get IDD (Indicador de Diferença entre os Desempenhos Observado e Esperado) data
Description
Downloads and processes microdata from IDD, an indicator that measures the value added by an undergraduate course to student performance. It compares ENADE scores with expected performance based on students' prior achievement (ENEM scores at admission).
Usage
get_idd(year, n_max = Inf, keep_zip = TRUE, quiet = FALSE)
Arguments
year |
The year of the indicator (2014-2019, 2021-2023). Note: there is no 2020 edition. |
n_max |
Maximum number of rows to read. Default is |
keep_zip |
Logical. If |
quiet |
Logical. If |
Details
IDD is calculated by INEP as part of the higher education quality assessment system. It complements ENADE by isolating the contribution of the course itself to student learning, controlling for student input quality.
The data includes:
Course and institution identifiers
IDD scores (continuous and categorical)
Number of students considered in the calculation
Related ENADE and ENEM metrics
Important notes:
IDD is published alongside ENADE results, following the same rotating cycle of course areas.
Column names are standardized to lowercase with underscores.
Not all courses have IDD values (minimum sample requirements apply).
Value
A tibble with IDD data in tidy format.
Data dictionary
For detailed information about variables, see INEP's documentation: https://www.gov.br/inep/pt-br/acesso-a-informacao/dados-abertos/microdados/idd
Examples
## Not run:
# get IDD data for 2023
idd <- get_idd(2023)
# get IDD data for 2021 with limited rows
idd_2021 <- get_idd(2021, n_max = 1000)
## End(Not run)
Get IDEB (Índice de Desenvolvimento da Educação Básica) data
Description
Downloads and processes IDEB data from INEP in tidy (long) format. IDEB is the main indicator of education quality in Brazil, combining student performance (from SAEB) with grade promotion rates.
Usage
get_ideb(level, stage, metric, year = NULL, quiet = FALSE)
Arguments
level |
The geographic level. Required.
|
stage |
The education stage. Required.
|
metric |
The type of data to return. Required.
|
year |
Optional. Integer vector of IDEB editions to filter
(e.g., |
quiet |
Logical. If |
Details
IDEB is calculated every two years since 2005 based on:
-
Learning: Average scores in Portuguese and Mathematics from SAEB
-
Flow: Grade promotion rate (inverse of repetition/dropout)
The index ranges from 0 to 10. Brazil's national goal is to reach 6.0 by 2022 (the level of developed countries in PISA).
The function always downloads the most recent IDEB file available from INEP, which contains the full historical series (2005-2025).
stage = "ensino_medio_integrado" reads the "Ensino médio mais
educação profissional técnica integrada" spreadsheets first
published with IDEB 2025. Unlike the traditional high school IDEB — which
excludes students of integrated technical-professional education (EPT
integrada) from the SAEB performance component to preserve historical
comparability — this cut includes them. INEP publishes it only at the
national and state levels (state networks only), covering editions
2017-2025 for states and 2019-2025 for Brazil, with no official targets.
Value
A tibble in tidy (long) format. Columns vary by level and metric:
ID columns (vary by level):
-
escola:uf_sigla,municipio_codigo,municipio_nome,escola_id,escola_nome,rede -
municipio:uf_sigla,municipio_codigo,municipio_nome,rede -
brasil:rede -
estado:uf_nome,uf_sigla,rede -
regiao:regiao,rede
Value columns (vary by metric):
-
indicador:ano,indicador,valor -
aprovacao:ano,ano_escolarorserie(ensino_medio),taxa_aprovacao -
nota:ano,disciplina,nota -
meta:ano,meta
Data source
Official IDEB portal: https://www.gov.br/inep/pt-br/areas-de-atuacao/pesquisas-estatisticas-e-indicadores/ideb
See Also
Other IDEB functions:
get_ideb_series(),
list_ideb_available()
Examples
## Not run:
# school-level IDEB indicators for early elementary
ideb <- get_ideb("escola", "anos_iniciais", "indicador")
# municipality-level approval rates, only 2023 and 2025
aprov <- get_ideb("municipio", "anos_finais", "aprovacao", year = c(2023, 2025))
# national IDEB targets
metas <- get_ideb("brasil", "ensino_medio", "meta")
# state-level SAEB scores
notas <- get_ideb("estado", "anos_iniciais", "nota")
# region-level IDEB indicators
regioes <- get_ideb("regiao", "anos_finais", "indicador")
# state-level IDEB including EPT integrada students (2025+ cut)
emi <- get_ideb("estado", "ensino_medio_integrado", "indicador")
## End(Not run)
Get IDEB historical series
Description
get_ideb_series() is deprecated because the new get_ideb() already
returns data in long format with all historical editions.
Use get_ideb(level, stage, metric) instead.
Usage
get_ideb_series(
years = NULL,
level = c("escola", "municipio"),
stage = c("anos_iniciais", "anos_finais", "ensino_medio"),
uf = NULL,
quiet = FALSE
)
Arguments
years |
Vector of years to include (default: all available). |
level |
The aggregation level. |
stage |
The education stage. |
uf |
Optional. Filter by state. |
quiet |
Logical. If |
Value
A tibble with IDEB data.
See Also
Other IDEB functions:
get_ideb(),
list_ideb_available()
Examples
## Not run:
# deprecated: use get_ideb() instead
ideb <- get_ideb("municipio", "anos_iniciais", "indicador")
## End(Not run)
Get IDEB Excel sheet name
Description
Internal function to determine which sheet to read for brasil/regiao_uf levels.
Usage
get_ideb_sheet(level, stage)
Arguments
level |
Geographic level. |
stage |
Education stage. |
Value
Sheet name (character) or NULL for escola/municipio.
Get IGC (Indice Geral de Cursos) data
Description
Downloads and processes IGC data from INEP. The IGC is a quality indicator for higher education institutions in Brazil, calculated as a weighted average of CPC scores across all evaluated courses plus CAPES scores for graduate programs.
Usage
get_igc(year, n_max = Inf, keep_file = TRUE, quiet = FALSE)
Arguments
year |
The year of the indicator (2007-2019, 2021-2023). Note: there is no 2020 edition. Years 2004-2006 used a different indicator ("Conceito Enade"). |
n_max |
Maximum number of rows to read. Default is |
keep_file |
Logical. If |
quiet |
Logical. If |
Details
IGC is calculated by INEP as part of the higher education quality assessment system (SINAES). It provides an overall quality measure for institutions, considering both undergraduate and graduate programs.
The data includes:
Institution identifiers (code, name, organization type)
IGC scores (continuous and categorical/faixa)
Number of courses and students considered
Component breakdown (undergraduate CPC average, graduate CAPES scores)
Important notes:
IGC is published annually based on the last three ENADE cycles.
There is no 2020 edition (COVID-19 suspension).
Column names are standardized to lowercase with underscores.
Files are in Excel format (xls/xlsx), except 2007, a 7z archive of CSV files.
From 2007 to 2016, INEP splits the table by type of institution (one sheet or CSV each for universities, university centers and faculties); all parts are read and stacked into one tibble.
Value
A tibble with IGC data in tidy format.
Data dictionary
For detailed information about variables, see INEP's documentation: https://www.gov.br/inep/pt-br/areas-de-atuacao/pesquisas-estatisticas-e-indicadores/indicadores-de-qualidade-da-educacao-superior
See Also
Other CPC/IGC functions:
get_conceito_enade(),
get_cpc()
Examples
## Not run:
# get IGC data for 2023
igc <- get_igc(2023)
# get IGC data for 2021 with limited rows
igc_2021 <- get_igc(2021, n_max = 1000)
## End(Not run)
Get SAEB (Sistema de Avaliação da Educação Básica) data
Description
Downloads and processes microdata from SAEB, the Brazilian Basic Education Assessment System. SAEB evaluates educational quality through student performance assessments in Portuguese and Mathematics.
Usage
get_saeb(
year,
type = c("aluno", "escola", "diretor", "professor", "secretario"),
level = c("fundamental_medio", "educacao_infantil"),
serie = NULL,
n_max = Inf,
keep_zip = TRUE,
quiet = FALSE
)
Arguments
year |
The year of the assessment (2011, 2013, 2015, 2017, 2019, 2021, 2023). |
type |
Type of data to load. Options:
|
level |
For 2021 only, SAEB was split into two files:
|
serie |
For
The numbers |
n_max |
Maximum number of rows to read. Default is |
keep_zip |
Logical. If |
quiet |
Logical. If |
Details
SAEB is conducted biennially by INEP and assesses students in grades 5 and 9 of elementary school, and grade 3 of high school. The data includes:
Student performance scores in Portuguese and Mathematics
School infrastructure and management questionnaires
Teacher and principal profiles
Important notes:
SAEB files can be large (several hundred MB).
Use
n_maxto read a sample first for exploration.Column names are standardized to lowercase with underscores.
In 2021, INEP split SAEB into two separate downloads (elementary/high school and early childhood). Use the
levelparameter to choose.Student files are split by grade from 2013 on; choose one with
serie. The 5th and 9th grade files are about 1 GB of CSV each. To combine grades, call once per grade, e.g.purrr::map(c("5ef", "9ef"), function(s) get_saeb(2023, serie = s)).For 2011,
type = "aluno"readsTS_RESULTADO_ALUNO(proficiency results), which covers all grades in one file.
Value
A tibble with SAEB microdata in tidy format.
Data dictionary
For detailed information about variables, see INEP's documentation: https://www.gov.br/inep/pt-br/acesso-a-informacao/dados-abertos/microdados/saeb
Examples
## Not run:
# get 5th grade student results for 2023
saeb_5ef <- get_saeb(2023, serie = "5ef", n_max = 10000)
# 5th and 9th grades, one call per grade
saeb_ef <- purrr::map(c("5ef", "9ef"), function(s) get_saeb(2023, serie = s))
# get school questionnaire data
saeb_escola <- get_saeb(2023, type = "escola")
# SAEB 2021: early childhood education
saeb_infantil <- get_saeb(2021, level = "educacao_infantil", n_max = 1000)
## End(Not run)
Decide which IDEB columns to keep for a given metric/year
Description
Internal helper for read_ideb_excel(). Keeps all non-vl_* columns
(id columns) and the subset of vl_* columns that match the requested
metric (and year, if given). Matching is done against a standardized
lowercase/ASCII form of the names so it works against the raw INEP
headers regardless of accents or casing.
Usage
ideb_keep_cols(col_names, metric, year = NULL)
Arguments
col_names |
Character vector of raw column names from the xlsx header. |
metric |
One of |
year |
Optional integer vector of IDEB editions. |
Value
Logical vector of the same length as col_names.
Fix IDEB column codes that INEP repeated with the wrong year
Description
Internal helper for read_ideb_excel(). Row 10 of an IDEB sheet holds
the column codes (VL_INDICADOR_REND_2023); rows above it hold the
block headers ("Taxa de Aprovacao - 2025"), merged over the columns of
each edition. When a VL_* code appears more than once, the year of
each copy is taken from its block header. Codes that are not repeated
are returned unchanged.
Usage
ideb_resolve_codes(file, sheet, col_names)
Arguments
file |
Path to the Excel file. |
sheet |
Sheet name or position. |
col_names |
Column names as read from row 10 (readxl may have
appended |
Value
A character vector of column names.
Find the institution-level sheets of an IGC spreadsheet
Description
Internal function. From 2008 to 2016, INEP splits the IGC table into one sheet per type of institution ("Universidades", "Centros Universitarios", "Faculdades" or "Outros"), followed by sheets with course- or program-level inputs. Returns the institution sheets, or the first sheet when the file is not split (2017 onwards).
Usage
igc_institution_sheets(file)
Arguments
file |
Path to the Excel file. |
Value
A character vector of sheet names.
List cached files
Description
Lists all files currently in the educabR cache.
Usage
list_cache(dataset = NULL)
Arguments
dataset |
Optional. Filter by dataset name. |
Value
A tibble with information about cached files.
See Also
Other cache functions:
clear_cache(),
get_cache_dir(),
set_cache_dir()
Examples
## Not run:
list_cache()
## End(Not run)
List available Censo Escolar files
Description
Lists the data files available in a downloaded School Census.
Use this to discover which files are available for a given year,
then pass the desired file name to get_censo_escolar()'s file
parameter.
Usage
list_censo_files(year)
Arguments
year |
The year of the census. |
Value
A character vector of file names found.
See Also
Other School Census functions:
get_censo_escolar()
Examples
## Not run:
# first download the data
get_censo_escolar(1995)
# then see what files are available
list_censo_files(1995)
# [1] "CENSOESC_1995.CSV" "DADOS_DESP_1995.CSV" "DADOSCURSO_1995.CSV"
# load a specific file
cursos <- get_censo_escolar(1995, file = "DADOSCURSO")
## End(Not run)
List available Higher Education Census files
Description
Lists the data files available in a downloaded Higher Education Census. Useful for exploring the contents of the ZIP file.
Usage
list_censo_superior_files(year)
Arguments
year |
The year of the census. |
Value
A character vector of file names found.
See Also
Other Higher Education Census functions:
get_censo_superior()
Examples
## Not run:
list_censo_superior_files(2023)
## End(Not run)
List the files of an ENADE edition
Description
Downloads (if needed) the microdata of an ENADE edition and lists its
data files with the variables each one holds. Use the arquivo number
with get_enade().
Usage
list_enade_files(year, quiet = FALSE)
Arguments
year |
The year of the exam. |
quiet |
Logical. If |
Value
A tibble with one row per file: arquivo (number to pass to
get_enade()), nome (file name), n_variaveis and variaveis
(the variables other than nu_ano and co_curso, comma-separated).
See Also
Other ENADE functions:
get_enade()
Examples
## Not run:
files <- list_enade_files(2023)
# which file has the overall score?
files[grepl("nt_ger", files$variaveis), ]
## End(Not run)
List available IDEB data
Description
Lists the IDEB data combinations available for download.
Usage
list_ideb_available()
Value
A tibble with available IDEB datasets (level, stage, metric).
See Also
Other IDEB functions:
get_ideb(),
get_ideb_series()
Examples
list_ideb_available()
Merge a sub-header row into the column names
Description
Internal function. Some INEP sheets have a second header row: IGC 2008 has "IGC" over two columns, with "Continuo" and "Faixas" below it, and repeats "Cod. IES". That row is detected as a first row that fills less than half of the columns and holds only text. Each of its cells completes the name of its column (a cell under an empty header completes the nearest named header to its left; a cell that repeats the header is ignored). The row is then dropped and the affected columns are re-typed.
Usage
merge_subheader_row(df)
Arguments
df |
A data frame. |
Value
The data frame.
Normalize the SAEB grade argument
Description
Internal function that turns the user's serie into INEP's lowercase
grade code: 5 becomes "5ef", "5EF" becomes "5ef".
Usage
normalize_saeb_serie(serie)
Arguments
serie |
A single grade code or number, or |
Value
A lowercase string, or NULL.
Normalize character columns to UTF-8 NFC
Description
Ensures every character column in a data frame is valid UTF-8 in
canonical NFC form. Without this step, equality comparisons against
string literals fail silently on Windows when the source file's
encoding produces decomposed (NFD) or otherwise non-canonical strings
(e.g. filter(rede == "Pública") returns 0 rows even though
"Pública" is in the data). Applied at every read entrypoint —
read_inep_file(), read_ideb_excel(), read_excel_safe(), and the
FUNDEB OData fetcher — so downstream user code can compare with
literals safely on any platform.
Usage
normalize_utf8_nfc(df)
Arguments
df |
A data frame. |
Value
The data frame with character columns normalized; non-character columns are returned unchanged.
Parse date columns (dt_, dh_) to Date
Description
Internal function to convert text date columns to Date objects. INEP
and CAPES use several formats: SAS datetime ("12FEB2024:00:00:00"),
"12/12/2013 00:00:00", "12/12/2013" and ISO "2013-12-12". For each
column the format that reads every non-empty value is used. If no
format reads them all, the column is kept as text: converting with a
single fixed format turned every value of the CAPES catalogo 2013-2016
dates into NA.
Usage
parse_sas_dates(df)
Arguments
df |
A data frame. |
Value
The data frame with date columns converted.
Read Excel file safely
Description
Internal function to read Excel files (xls/xlsx) with error handling. Reads the first sheet by default. Three INEP layout quirks are handled:
a title row above the header (e.g. IGC 2009) is skipped, by taking as header the first row where at least half of the columns are filled;
a sub-header row below the header (e.g. IGC 2008: "IGC" over "Continuo" and "Faixas") is merged into the column names;
blank, footnote and total rows (e.g. CPC 2021 and 2022, IGC 2021), i.e. rows with at most one filled cell, are dropped.
Usage
read_excel_safe(file, n_max = Inf, sheet = 1)
Arguments
file |
Path to the Excel file. |
n_max |
Maximum number of rows to read. |
sheet |
Sheet name or position. Default is the first sheet. |
Value
A tibble with the data.
Read IDEB Excel file
Description
Internal function to read IDEB Excel files. When metric is provided,
performs a two-pass read: the header is parsed first to identify which
vl_* columns belong to the requested metric (and optionally the requested
years), then the file is re-read with col_types = "skip" on the
irrelevant columns. This drastically reduces peak memory for school-level
files, which can otherwise balloon to several GB when read in full.
Usage
read_ideb_excel(file, sheet = NULL, metric = NULL, year = NULL)
Arguments
file |
Path to the Excel file. |
sheet |
Sheet name to read (NULL for first sheet). |
metric |
Optional. If provided, restricts the read to the |
year |
Optional. Integer vector. When provided alongside |
Value
A tibble with the data.
Read INEP data file
Description
Internal function to read INEP data files with appropriate settings.
Usage
read_inep_file(file, delim = ";", encoding = NULL, n_max = Inf, quiet = FALSE)
Arguments
file |
Path to the data file. |
delim |
The delimiter character. |
encoding |
The file encoding. |
n_max |
Maximum number of rows to read. |
quiet |
Logical. If |
Value
A tibble with the data.
Re-read columns that readr failed to parse
Description
Internal helper for read_inep_file(). readr guesses each column type
from the first 1,000 rows; a column that is empty there is read as
logical and every later value becomes NA (Censo Escolar 1995: 234
values of VEM2206, 1997: 567 of VPE626). Columns with parsing
problems are read again as text and their type is guessed from all
values. Columns without problems are untouched.
Usage
reread_problem_columns(df, file, delim, encoding, n_max = Inf)
Arguments
df |
The tibble returned by |
file, delim, encoding, n_max |
The arguments of that read. |
Value
The tibble with those columns replaced.
Reshape IDEB data from wide to long format
Description
Internal function to transform IDEB data from wide format (one column per year/metric) to tidy long format, filtered by the requested metric type.
Usage
reshape_ideb(df, level, metric, stage = NULL)
Arguments
df |
Data frame with IDEB data (wide format, standardized names). |
level |
Geographic level (determines ID columns). |
metric |
Type of metric to extract. |
Value
A tibble in long format.
Set the cache directory for educabR
Description
Sets the directory where downloaded files will be cached. This avoids repeated downloads of the same data.
Usage
set_cache_dir(path = NULL, persistent = FALSE)
Arguments
path |
A character string with the path to the cache directory.
If |
persistent |
Logical. If |
Value
Invisibly returns the cache directory path.
See Also
Other cache functions:
clear_cache(),
get_cache_dir(),
list_cache()
Examples
## Not run:
# set a custom cache directory (use tempdir() in examples)
set_cache_dir(file.path(tempdir(), "educabR_cache"))
## End(Not run)
Standardize column names
Description
Internal function to standardize column names to lowercase with underscores.
When two names collide after standardization (CPC 2007/2008 have both
"Docentes Doutores" and "% Docentes Doutores"), a "%" in the colliding
original name becomes "pct"; any collision left gets a numeric suffix
(_2, _3, ...). Names that do not collide are unchanged.
Usage
standardize_names(df)
Arguments
df |
A data frame. |
Value
The data frame with standardized names.
Convert UF abbreviation to code
Description
Internal function to convert state abbreviations to IBGE codes.
Usage
uf_to_code(uf)
Arguments
uf |
UF abbreviation or code. |
Value
The numeric UF code.
Validate downloaded data structure
Description
Internal function to validate that downloaded data has the expected structure. Issues warnings for potential problems and errors for critical issues.
Usage
validate_data(data, dataset, year)
Arguments
data |
A tibble with the downloaded data. |
dataset |
The dataset name ("enem", "enem_itens", "ideb", "censo_escolar"). |
year |
The year of the data. |
Value
The input data (invisibly), or aborts with an error.
Validate year parameter
Description
Internal function to validate that a year is available for a dataset.
Usage
validate_year(year, dataset)
Arguments
year |
The year to validate. |
dataset |
The dataset name. |
Value
The validated year (invisibly), or aborts with error.