Closed asadow closed 1 year ago
I don't believe that survey_questions()
says anything about variable labels as an attribute, right?
You can get it from fetch_survey()
:
library(qualtRics)
my_survey <- fetch_survey("SV_3gxxxx", add_column_map = TRUE, force_request = TRUE)
#> | | | 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.
attr(my_survey, "column_map")
#> # A tibble: 24 × 7
#> qname description main sub ImportId timeZone choiceId
#> <chr> <chr> <chr> <chr> <chr> <chr> <lgl>
#> 1 StartDate Start Date Star… "" startDa… Z NA
#> 2 EndDate End Date End … "" endDate Z NA
#> 3 Status Response Type Resp… "" status <NA> NA
#> 4 IPAddress IP Address IP A… "" ipAddre… <NA> NA
#> 5 Progress Progress Prog… "" progress <NA> NA
#> 6 Duration (in seconds) Duration (in se… Dura… "" duration <NA> NA
#> 7 Finished Finished Fini… "" finished <NA> NA
#> 8 RecordedDate Recorded Date Reco… "" recorde… Z NA
#> 9 ResponseId Response ID Resp… "" _record… <NA> NA
#> 10 RecipientLastName Recipient Last … Reci… "" recipie… <NA> NA
#> # … with 14 more rows
Created on 2022-04-27 by the reprex package (v2.0.1)
Right, but it says question labels, which has a different definition for Qualtrics @ https://www.qualtrics.com/support/survey-platform/survey-module/editing-questions/formatting-questions/
So what do you mean by question labels?
Thanks for your continued help.
Ah OK, that is not something I am as familiar with. It looks like this is returned in the API call made for survey_questions
but we are not including it here:
We would need to add something like qlabel = purrr::map_chr(qi, "questionLabel")
there but this doesn't work when it is all NULL
(like for all my surveys).
Are you interested in working on this and contributing a PR?
@adamofthegarden FYI survey_questions()
is likely to be retired or at least fundamentally changed at whatever point the move to the v3 endpoint under #267 occurs. I'm personally super grateful for all the work people do on this package but I feel like that's worth mentioning so that people don't end up investing time in something that might be about to be undone.
The function documentation mentions that variable labels are stored as attributes. How can I access them?
Created on 2022-04-27 by the reprex package (v2.0.1)