Normalize a data frame according to Sequoia table definitions
seq_normalize.Rdseq_normalize() standardizes the structure of a data.frame using the
Sequoia configuration stored in inst/config/seq_fields.yaml and
seq_tables.yaml.
Details
The normalization process applies, in order:
Field renaming using configured aliases
Field selection: add missing required fields and drop invalid ones
Type coercion to the classes defined in the configuration
Column reordering according to the table definition
This ensures that the resulting data frame matches exactly the schema expected for the selected Sequoia table.
Field aliases defined in seq_fields.yaml allow multiple column names
(e.g. "foret", "id") to be mapped to the canonical field name
(e.g. "IDENTIFIANT").
Aliases are automatically detected and replaced during normalization.
For example, if the configuration contains:
Then:
names(df)
#> c("foret", "contenance")
df <- seq_normalize(df, "parca")
names(df)
#> c("IDENTIFIANT", "SURF_CAD")