class: center, middle, inverse, title-slide .title[ # Skills Lab 05: Survey Data ] .subtitle[ ##
Ready, Steady, WRANGLE!
] .author[ ### Dr Danielle Evans ] .date[ ### 23 February 2023 ] --- <style type="text/css"> a { color: #f77b00; } </style> ## Overview - **Qualtrics** + What is it? + Setting up a survey + Navigating Qualtrics quirks + Downloading our data - **R** + Reading in our data + Data exploration - **Data Wrangling** + Recoding values + Fixing weirdness -- <br> <br> .center[ ### *Let's get ready to wrangle!!* ] --- ## Qualtrics - **Qualtrics** is an online survey software where you can create/host questionnaires and collect data from participants - It's used widely by researchers in the school, and will be used by a lot of you for your **dissertations** next year (a scary thought I know...) - It's relatively straightforward to use but there are some 'quirks' 🙄 - So first, we're going to run through setting up a survey in **Qualtrics** and how we navigate these 'quirks' - Then I'll demo how we get these data into **R**, how we can explore our data, and how we might go about preparing our data for **factor analysis** <br><br> <div class="tu" style="font-size:90%"> <p><b>Top Tip!</b> Qualtrics can set stuff up weirdly - test it out thoroughly & check the data downloads appropriately <i>before</i> sending it out to participants! </p> </div> --- ## Qualtrics - **Qualtrics** is an online survey software where you can create/host questionnaires and collect data from participants - It's used widely by researchers in the school, and will be used by a lot of you for your **dissertations** next year (a scary thought I know...) - It's relatively straightforward to use but there are some 'quirks' 🙄 - So first, we're going to run through setting up a survey in **Qualtrics** and how we navigate these 'quirks' - Then I'll demo how we get these data into **R**, how we can explore our data, and how we might go about preparing our data for **factor analysis** <br><br><br> <div class="pc" style="font-size:90%"> <p><b>Demo!</b> Setting up the survey! </p> </div> --- ## Qualtrics Quirks - We should check several parts of our **Qualtrics** survey *before* we send it out to participants: - **Practical considerations** + Question wording + Response type, requirements & validation + Coding/scoring of responses - **Ethical considerations** + Participant information sheet + Informed consent + Debrief + IP addresses <br> <div class="swr" style="font-size:90%"> <p><b>Pet Peeve!</b> Qualtrics annoyingly collects <b>IP addresses</b> from our participants automatically - it's very important for <b>ethics</b> that we turn this off in settings!! </p> </div> --- ## Qualtrics Quirks - We should check several parts of our **Qualtrics** survey *before* we send it out to participants: - **Practical considerations** + Question wording + **Response type, requirements & validation** + **Coding/scoring of responses** - **Ethical considerations** + Participant information sheet + Informed consent + Debrief + **IP addresses** <br> <div class="pc" style="font-size:90%"> <p><b>Demo!</b> Response types, response requirements & validation, survey workflow, changing item scoring, & removing IP addresses! </p> </div> --- ## Reading & Exploring Data - Once our survey is ready and has been filled in by participants, we can export our data file in a **.csv** format - We've worked with these types of files LOADS so it isn't anything new to us - We can use the **readr::read_csv()** function to import our data into **R**, in the same way we have done previously - We then should employ a range of **functions()** to explore our data: + We want to check everything has imported as we expected it to + We want to figure out what data wrangling we need to do + We want to take note of any weirdness from our checks <br><br><br> <div class="pc" style="font-size:90%"> <p><b>Demo!</b> <b>Downloading our .csv, reading it into R</b> & exploring our data! </p> </div> --- ## Data ExploRation .center[ <iframe src="https://embed.polleverywhere.com/discourses/Zb7HSxMzyGT2cesWrobrI?controls=none&short_poll=true" width="100%" height="370px"></iframe> ] <div class="tu" style="font-size:90%"> <p><b>Top Tip!</b> Make notes and <b>#</b>comments as you explore & wrangle through your data, it really is super easy to forget what you've done & <i>why!</i> </p> </div> --- ## Data ExploRation .center[ <iframe src="https://embed.polleverywhere.com/discourses/Zb7HSxMzyGT2cesWrobrI?controls=none&short_poll=true" width="100%" height="370px"></iframe> ] <div class="pc" style="font-size:90%"> <p><b>Demo!</b> Downloading our .csv, reading it into R & <b>exploring our data!</b> </p> </div> --- ## Keeping it simple - When we download our data from **Qualtrics**, we'll often have a bunch of extra variables that we usually don't want or need - These include things like: start date, end date, user language, duration, distribution channel... - We might also get some extra rows that contain question labels or descriptions, and NOT data from our participants - we don't want this either! - So, we can make our data easier to work with by using the **slice()**, **filter()**, and **select()** functions from **dplyr::** - We can remove any extra rows, any variables we don't need, and any participants that didn't consent to our study <br><br> <div class="pc" style="font-size:90%"> <p><b>Demo!</b> Using <b>slice()</b>, <b>filter()</b> & <b>select()</b> to tidy up our data!</p> </div> --- ## Help! I forgot to recode my items! - After exploring your data, you might find that you didn't set up your survey properly - But that's OK... we first need to figure out how the variables are currently measured/scored, and what they need to become - Then we can wrangle our data and shape it into whatever we need using a variety of **functions()** - The most useful functions for **recoding** come from **Base R** and **dplyr**: + **as.numeric()** + **replace()** + **dplyr::mutate()** + **dplyr::recode()** <br> <div class="mb" style="font-size:90%"> <p><b>Watch Out!</b> We don't <i>ever</i> want to make edits to our raw <b>.csv</b> file - we should only ever manipulate our data in <b>R</b>!! #openscience 🧠</p> </div> --- ## Help! I forgot to recode my items! **For recoding numeric data:** .teeny[ ```r data <- data %>% dplyr::mutate(., col_name = dplyr::recode(col_name, `1` = 5)) ``` **For recoding character data:** ```r data <- data %>% dplyr::mutate(., col_name = dplyr::recode(col_name, "stduent" = "student")) ``` **For changing character data to numeric:** ```r data <- data %>% dplyr::mutate(col_name = as.numeric(col_name)) ``` **For recoding specific numeric values to NAs:** ```r data <- data %>% dplyr::mutate(col_name = replace(col_name, col_name > 10, NA)) ``` ] <br> <div class="pc" style="font-size:90%"> <p><b>Demo!</b> Recoding numeric values, recoding text, recoding weiRdness to NAs</p> </div> --- ## *That's all - happy wrangling!* <br> <br> <img src="data:image/png;base64,#./img/rhumble2.gif" width="75%" style="display: block; margin: auto;" /> <br><br> .center[ <br><br> [Give session feedback here!](https://forms.gle/ZyXAB7kZzUUyct9n6) 😀 ]