spss_swap | R Documentation |
In many situations it can be useful to have the ability to replace the uninformative variable names (colnames) from a SPSS matrix (e.g. SD02, SD08_02) with their respective label attribute (e.g., "Gender/Sex" or "Age 15-25"). This function utilizes the utility function clean_names to convert the labels from SPSS to proper variable names (e.g.,"gender_sex" or "age_15_25") and sets them as new column names
spss_swap( df, repl_umlaut = TRUE, old_itemnames = c("remove", "prepend", "append") )
df |
tibble read in the |
repl_umlaut |
Default is TRUE. If provided True it replaces umlauts (vowel mutations) like ä, ö, ü and ß with respective ae, oe, ue, and ss |
old_itemnames |
Options are "prepend", "append" or, "remove". Default is "prepend" With "prepend" the new item names will be prepended by the old item names. E.g., the old item name was "q0003" and the description "Gender" the new item name will be "q0003_gender" |
A tibble with more human readable names (old labels as names)
Friedrich-Samuel Taubitz & Bjoern Buedenbender
## Not run: datscience::spss_swap(df_sav) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.