Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated SurveyData function to handle haven-labelled data #159

Open
wants to merge 18 commits into
base: master
Choose a base branch
from

Conversation

Dewi-Amaliah
Copy link
Collaborator

@Dewi-Amaliah Dewi-Amaliah commented Aug 4, 2023

Updated SurveyData function to automatically read haven-labelled data to survey question and survey responses

@lauken13 lauken13 requested review from jgabry and lauken13 August 4, 2023 02:29
@Dewi-Amaliah
Copy link
Collaborator Author

Hi all,

Here is the example code of using the haven functionality

survey_dat <- SurveyData$new(feline_survey_haven)
survey_dat$questions()
survey_dat$responses()

@lauken13
Copy link
Owner

lauken13 commented Sep 13, 2023

This is great! Some thoughts:

  • the code is failing on the checks because the new haven labelled data hasn't been documented
  • if there is a variable that is missing labels for the levels BUT is a haven labelled variable, it won't be included e.g:

`survey_dat <- SurveyData$new(feline_survey_haven)
survey_dat$questions()
survey_dat$responses()

generate_dictionary(feline_survey_haven) %>% View()

feline_survey_haven2 <- feline_survey_haven %>%
mutate(pet_own = remove_val_labels(pet_own))

survey_dat <- SurveyData$new(feline_survey_haven2)
survey_dat$questions()
survey_dat$responses()`

  • Do we want to be able to do a mix of labelled and unlabelled?

@lauken13
Copy link
Owner

From the meeting:

  • Decided to have a preference list:
    For each variable:
    -> if it's explicitly named in the function input then use those labels
    -> else if its a haven labelled variable then use those variables
    -> else if its a factor labelled variable then use the factor level names
    -> else if its a binary variable then code 0 or 1 as the label

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants