Skip to contents

Reads ENEMDU microdata and returns an object prepared for the enemduR workflow.

Usage

enemdu_read_data(
  path,
  survey_type,
  period = NULL,
  standardize_names = TRUE,
  inform_scope = TRUE,
  encoding = NULL,
  csv_delim = NULL,
  ...
)

Arguments

path

Path to a .sav, .dta or .csv file.

survey_type

One of "mensual", "trimestral" or "anual".

period

Optional period identifier used for comparability warnings. Typical values are "2020-09", "2021-05" or "2018".

standardize_names

Logical. If TRUE, variable names are normalized to lower snake case.

inform_scope

Logical. If TRUE, emits a message describing the representativity scope of the loaded survey type.

encoding

Optional file encoding. Passed to haven::read_sav() and haven::read_dta() for SPSS/Stata files. For CSV files, it is used in readr::locale(). If NULL, CSV reading uses "UTF-8".

csv_delim

Optional delimiter for CSV files. If NULL, the delimiter is detected from the first non-empty lines among comma, semicolon and tab.

...

Additional arguments passed to the format-specific reader: haven::read_sav(), haven::read_dta() or readr::read_delim().

Value

A data frame with class enemdu_tbl and basic ENEMDU attributes.

Details

The operational primary format for recent official ENEMDU microdata is .sav. The function also supports .dta and .csv files for interoperability with analytical workflows that export or transform the original source.

The function stores the ENEMDU survey type, input format, source path, design variables, and optional period metadata as object attributes. It can also emit a representativity scope message according to the loaded base: monthly, quarterly, or annual.