process_cnes: Prepare CNES microdata

View source: R/process_cnes.R

process_cnesR Documentation

Prepare CNES microdata

Description

Recodes supported CNES fields into descriptive values and normalizes escaped Unicode text. Establishment ("CNES-ST") and professional ("CNES-PF") records have different layouts and are processed accordingly.

Usage

process_cnes(
  data,
  information_system = c("CNES-ST", "CNES-PF"),
  nomes = FALSE,
  municipality_data = TRUE
)

Arguments

data

A data frame returned by fetch_datasus() or another data frame with a compatible CNES layout.

information_system

A single character string: "CNES-ST" for establishments or "CNES-PF" for professionals.

nomes

Logical scalar. For "CNES-ST" data, if TRUE, download the current CADGER table with fetch_cadger() and add establishment trade names. This requires network access. It has no effect for "CNES-PF".

municipality_data

Logical scalar. If TRUE, add municipality names and available territorial attributes for supported municipality-code columns.

Details

Columns not explicitly recoded are retained, but Unicode normalization is applied to every column and consequently the returned tibble contains character columns. Lookup joins can add establishment, occupation, and municipality information.

Value

A tibble with character columns. Supported codes are replaced with descriptions, and requested lookup fields are added where applicable.

References

Saldanha, R. F. (2026). CNES – Cadastro Nacional de Estabelecimentos de Saúde.

See Also

fetch_datasus(), fetch_cadger()

Examples

process_cnes(cnes_st_sample, information_system = "CNES-ST")
process_cnes(cnes_pf_sample, information_system = "CNES-PF")


microdatasus documentation built on July 29, 2026, 5:08 p.m.