Created
November 30, 2019 15:22
-
-
Save JosiahParry/36316c2614110049d514f1ecf2ef7184 to your computer and use it in GitHub Desktop.
Useful quick tricks I learned to deal with the hell that is SPSS .sav data format
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# read in sav file | |
noise <- haven::read_sav("http://staff.bath.ac.uk/pssiw/stats2/noisedata.sav") | |
# convert coded response to response text | |
haven::as_factor(noise) | |
# read in sav file with column labels | |
personality <- haven::read_sav("http://staff.bath.ac.uk/pssiw/stats2/personality.sav") | |
# generate a get_label f(x) via purr | |
get_label <- purrr::attr_getter("label") | |
# use get_label to retrieve column labels | |
map_chr(personality, get_label) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment