Newer
Older
library(limer)
library(tidyverse)
# HERE WE SET UP THE REPECTIVE SURVEY OPTIONS, SO THIS SHOULD BE CHANGED!!!
options(lime_api = 'https://survey3.gwdg.de/index.php?r=admin/remotecontrol')
options(lime_username = 'maike.kleemeyer')
options(lime_password = 'Zfznye5XUJWQ')
get_session_key()
# include the survey ID (to be found on the LimeSurvey page) here --> this only gets us complete data sets
responses <- get_responses(944399)
# recode data from text answers to numerical data we can work with
# QUESTION: How do we code "KEINE ANTWORT"?? As opposed to no answer provided and not applicable )because never happened)?
# RECODING of I Question??
responses_de <- responses %>%
# deselect those variables that only introduce the question
select(-c('A02','B01','B08','C01','D01','D07','D09','D13','E02','E06','F01','F09','F12','H01','H08','H16','H22')) %>%
mutate_if(is.logical, as.character) %>%
# replace all those values that did not have content because the question was not shown
# take all those variables to the front that do not need recoding
relocate(id:seed, D30, D21, E20, E14, F30, F31, F20, H14, H15) %>%
# recode written answers into numerical data
mutate(across(A01:I02, ~recode(., "Die Karrieren von Frauen werden stärker gefördert als die von Männern" = -1,
"Die Karrieren von Frauen und Männern werden gleichermaßen gefördert" = 0,
"Ja" = 1, "Stimme überhaupt nicht zu" = 1, "Nie" = 1, "1" = 1, "Sehr unzufrieden" = 1, "Die Karrieren von Frauen werden weniger gefördert als die von Männern" = 1, "Ist mir bereits bekannt." = 1, "Weiblich" = 1,
"Nein" = 2, "Stimme nicht zu" = 2, "Gelegentlich" = 2, "2" = 2, "Unzufrieden" = 2, "Ist mir nicht bekannt." = 2, "Männlich" = 2,
"Weder noch" = 3, "Monatlich" = 3, "3" = 3, "Weder zufrieden noch unzufrieden" = 3, "Divers" = 3,
"Stimme zu" = 4, "Wöchentlich" = 4, "4" = 4, "Zufrieden" = 4,
"Stimme voll und ganz zu" = 5, "Täglich" = 5, "5" = 5, "Sehr zufrieden" = 5,
"mehr als 5" = 6, "Noch in Bearbeitung" = 6,
"Keine Antwort" = NA_real_, "Keine Antwort." = NA_real_, "Keine Angabe" = NA_real_, "N/A" = NA_real_,
.missing = NA_real_)))
responses_en <- responses %>%
filter(startlanguage=="en") %>%
select_if(~!is.logical(.)) %>%
mutate_all(na_if,"") %>%
mutate(across(A01:D20.SQ007., ~recode(., "Yes" = 1, "Strongly disagree" = 1, "Never" = 1, "No" = 2, "Disagree" = 2, "Occasionally" = 2, "Neither agree nor disagree" = 3, "Monthly" = 3, "Agree" = 4, "Weekly" = 4, "Strongly agree" = 5, "Daily" = 5, "No answer " = NA_real_, "N/A" = NA_real_, .missing = NA_real_, .default = 999))) %>%
mutate(E01 = recode(E01, "The careers of women are promoted less than those of men" = 1, "The careers of women and men are promoted equally" = 0, "The careers of women are promoted more than those of men" = -1, "No answer " = NA_real_, "N/A" = NA_real_, .missing = NA_real_, .default = 999)) %>%
mutate(across(E03:F19.SQ007., ~recode(., "Yes" = 1, "Strongly disagree" = 1, "Never" = 1, "No" = 2, "Disagree" = 2, "Occasionally" = 2, "Neither agree nor disagree" = 3, "Monthly" = 3, "Agree" = 4, "Weekly" = 4, "Strongly agree" = 5, "Daily" = 5, "No answer " = NA_real_, "N/A" = NA_real_, .missing = NA_real_, .default = 999))) %>%
mutate(across(G01.SQ001.:G04.SQ002., ~recode(., "I am aware of this possibility" = 1, "I am not aware of this possibility" = 2, "No Answer" = NA_real_, "N/A" = NA_real_))) %>%
mutate(across(H02:H14, ~recode(., "Yes" = 1, "Strongly disagree" = 1, "Never" = 1, "No" = 2, "Disagree" = 2, "Occasionally" = 2, "Neither agree nor disagree" = 3, "Monthly" = 3, "Agree" = 4, "Weekly" = 4, "Strongly agree" = 5, "Daily" = 5, "No answer " = NA_real_, "N/A" = NA_real_, .missing = NA_real_, .default = 999))) %>%
mutate(across(H17:H21, ~recode(., "Yes" = 1, "Strongly disagree" = 1, "Never" = 1, "No" = 2, "Disagree" = 2, "Occasionally" = 2, "Neither agree nor disagree" = 3, "Monthly" = 3, "Agree" = 4, "Weekly" = 4, "Strongly agree" = 5, "Daily" = 5, "No answer " = NA_real_, "N/A" = NA_real_, .missing = NA_real_, .default = 999)))
responses_coded <- bind_rows(responses_de,responses_en)
release_session_key()