
Match food names in a dataset to an internal standard food list
Source:R/clean_hces.R
match_food_names_v1.Rd
This function matches food names in a dataset to a standard food list based on the closest string distance match. It then appends the food item code, standard food name, source and match confidence level to the dataset.
Arguments
- data
A data frame containing the food names to be matched.
- country
A character string specifying the country for which the food list should be generated.
- survey
A character string specifying the survey for which the food list should be generated.
- food_name_col
A character string specifying the name of the column in
data
that contains the food names to be matched.- match_confidence
A numeric value specifying the minimum match confidence level required for a match to be considered valid. Defaults to 90.
Value
A data frame with the following columns:
- food_item_code
A character string containing the standard food item code for the matched food item.
- standard_original_food_name
A character string containing the standard food name for the matched food item.
- food_match_source
A character string containing the source of the matched food item.
- food_match_confidence
A numeric value containing the match confidence level for the matched food item.