ropensci / qualtRics

Download ⬇️ Qualtrics survey data directly into R!
https://docs.ropensci.org/qualtRics
Other
215 stars 70 forks source link

Fetch recode values #218

Closed Rory-OG closed 3 years ago

Rory-OG commented 3 years ago

It seems as though the fetch_survey command pulls in variable name changes, however, none of the recoded values I've made and published in my survey are coming through. I haven't seen anything in the documentation that specifically calls out what is or is not done with recoded values by default. Is there a way to added this as a default. If this is just ignorance on my part, I would appreciate some guidance on how to pull recoded values with fetch_survey.

juliasilge commented 3 years ago

Do you mean "recode values" in this sense? In that case, you can use label = FALSE, convert = FALSE when you fetch your survey to get the survey responses as values:

library(tidyverse)
library(qualtRics)

fetch_survey("SV_3gbwq8aJgqPwQDP", force_request = TRUE, label = TRUE) %>%
  select(Q63, Q16)
#>   |                                                                              |                                                                      |   0%  |                                                                              |======================================================================| 100%
#> 
#> ── Column specification ────────────────────────────────────────────────────────
#> cols(
#>   .default = col_character(),
#>   StartDate = col_datetime(format = ""),
#>   EndDate = col_datetime(format = ""),
#>   Progress = col_double(),
#>   `Duration (in seconds)` = col_double(),
#>   Finished = col_logical(),
#>   RecordedDate = col_datetime(format = ""),
#>   RecipientLastName = col_logical(),
#>   RecipientFirstName = col_logical(),
#>   RecipientEmail = col_logical(),
#>   ExternalReference = col_logical(),
#>   LocationLatitude = col_double(),
#>   LocationLongitude = col_double(),
#>   SolutionRevision = col_double()
#> )
#> ℹ Use `spec()` for the full column specifications.
#> # A tibble: 26 x 2
#>    Q63          Q16                               
#>    <ord>        <ord>                             
#>  1 Once a month Somewhat satisfied                
#>  2 Less often   Somewhat dissatisfied             
#>  3 Once a month Neither satisfied nor dissatisfied
#>  4 Do not use   Neither satisfied nor dissatisfied
#>  5 Less often   Extremely satisfied               
#>  6 Less often   Somewhat satisfied                
#>  7 Weekly       Neither satisfied nor dissatisfied
#>  8 Less often   Extremely dissatisfied            
#>  9 Daily        Neither satisfied nor dissatisfied
#> 10 Do not use   Neither satisfied nor dissatisfied
#> # … with 16 more rows

fetch_survey("SV_3gbwq8aJgqPwQDP", force_request = TRUE, label = FALSE, convert = FALSE) %>%
  select(Q63, Q16)
#>   |                                                                              |                                                                      |   0%  |                                                                              |======================================================================| 100%
#> 
#> ── Column specification ────────────────────────────────────────────────────────
#> cols(
#>   .default = col_double(),
#>   StartDate = col_datetime(format = ""),
#>   EndDate = col_datetime(format = ""),
#>   IPAddress = col_character(),
#>   RecordedDate = col_datetime(format = ""),
#>   ResponseId = col_character(),
#>   RecipientLastName = col_logical(),
#>   RecipientFirstName = col_logical(),
#>   RecipientEmail = col_logical(),
#>   ExternalReference = col_logical(),
#>   DistributionChannel = col_character(),
#>   UserLanguage = col_character(),
#>   Q19 = col_character(),
#>   Q22 = col_character()
#> )
#> ℹ Use `spec()` for the full column specifications.
#> # A tibble: 26 x 2
#>      Q63   Q16
#>    <dbl> <dbl>
#>  1     3     4
#>  2     4     2
#>  3     3     3
#>  4     5     3
#>  5     4     5
#>  6     4     4
#>  7     2     3
#>  8     4     1
#>  9     1     3
#> 10     5     3
#> # … with 16 more rows

Created on 2021-05-03 by the reprex package (v2.0.0)

I assume that the API will publish your recoded values and not whatever was there originally (I hope 🤞 ).

jmobrien commented 3 years ago

Also, referencing the pictures in @juliasilge 's link, I believe that if those checkboxes for "recode values" aren't selected, you can still see the recodes in that menu but they don't pass through to the downloaded responses (whether from qualtRics/the API or the web interface, either one). Maybe something else to check on that end.

juliasilge commented 3 years ago

Let us know if you have further questions! 🙌