R/dataset_checks.R
dataset_check_categorical_substitutions.RdLists each categorical value a dataset has that is not an allowed value of
its trait in traits.yml, and was therefore moved to excluded_data with
the error "Unsupported trait value". The result is laid out as a table of
substitutions with replace empty: fill in replace for each value, in R
or a spreadsheet, and add them to the dataset's metadata.yml with
metadata_add_substitutions_table(x, "dataset_id", "trait_name", "find", "replace").
dataset_check_categorical_substitutions(database, dataset_ids = NULL)Tibble with one row per dataset, trait and unsupported value, with
columns dataset_id, trait_name, find, replace (empty), n_records,
the number of records excluded with that value, and unsupported, the
words in find that are not allowed values of the trait.
The values are as the build left them, after the dataset's existing
substitutions and the synonyms declared in traits.yml were applied, and
lower-cased, as find is matched. A value holding several space-separated
values is excluded whole when any one of them is not allowed; unsupported
lists which, since a single match: word substitution can fix that word
wherever it occurs (see metadata_add_substitution()).
if (FALSE) { # \dontrun{
substitutions <- dataset_check_categorical_substitutions(austraits, "Test_2025")
# ... fill in `replace`, then
metadata_add_substitutions_table(substitutions, "dataset_id", "trait_name", "find", "replace")
} # }