
Assign unit codes to a data frame based on a unit codes CSV file
Source:R/clean_hces.R
match_unit_names_v1.Rd
This function assigns unit codes to a data frame based on a unit codes CSV file. The CSV file must contain a column with unit names and a column with corresponding unit codes. The function removes special characters from the unit names before matching them to the data frame.
Usage
match_unit_names_v1(
data,
country,
survey,
unit_code_col,
unit_name_col,
unit_codes_csv = NULL
)
Arguments
- data
A data frame to modify.
- country
A character string specifying the country of the data.
- survey
A character string specifying the survey of the data.
- unit_code_col
A character string specifying the name of the column in the data frame to store the unit codes.
- unit_name_col
A character string specifying the name of the column in the data frame to match the unit names.
- unit_codes_csv
A character string specifying the file path of the unit codes CSV file. If NULL, the internal data hcesNutR::unit_codes will be used.