This package provides functions to apply a new categorisation dictionary to the food numbers in the Scottish Health Survey data, updating four files:
- The food-level file holding data on meals consumed,
- The day-level foods file holding data on total food consumed per day,
- The day-level nutrients file holding data on total nutrients consumed per day,
- The person-level file holding data on the average daily intake per person.
To use the package, you need Scottish Health Survey data. This is available in multiple formats, but this package requires the SPSS (.sav) version of the data.
You also need a dictionary file defining what the new food categories are for each food number.
Use the update_categories function to read in the data and the dictionary and update the data:
updated_data = update_categories(directory = "myfolder/UKDA-9518-spss/",
dictionary_filepath = "myfolder/dictionary.csv")The directory argument should point to the root folder of the SHeS data. The dictionary_filepath argument to point to the dictionary file itself.
Once the data is updated, you can use the save_shes_data function to save it in the same format as the original data (four .sav files):
save_shes_data(updated_data, directory = "myfolder/outputs")