Skip to content
ScotGovAnalysisPublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

22 Commits

Folders and files

Repository files navigation

Updating Scottish Health Survey food categories

This package provides functions to apply a new categorisation dictionary to the food numbers in the Scottish Health Survey data, updating four files:

  1. The food-level file holding data on meals consumed,
  2. The day-level foods file holding data on total food consumed per day,
  3. The day-level nutrients file holding data on total nutrients consumed per day,
  4. The person-level file holding data on the average daily intake per person.

Required data

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.

Using the package

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")

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages