-
Notifications
You must be signed in to change notification settings - Fork 71
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
Support non-ordered factors when converting data #241
Comments
I think what you want is library(qualtRics)
library(tidyverse)
sourdough <- fetch_survey("SV_5BJRo2RGHajIlOB", label = TRUE, convert = FALSE, 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(),
#> Q1007 = col_double(),
#> Q1_DO_1 = col_double(),
#> Q1_DO_2 = col_double(),
#> Q1_DO_3 = col_double(),
#> Q1_DO_4 = col_double(),
#> Q1_DO_5 = col_double(),
#> SolutionRevision = col_double(),
#> FL_6_DO_FL_7 = col_double()
#> # ... with 4 more columns
#> )
#> ℹ Use `spec()` for the full column specifications.
# this would be ordered otherwise
sourdough %>% count(Q1002)
#> # A tibble: 8 × 2
#> Q1002 n
#> <chr> <int>
#> 1 Associate degree in college (2-year) 11
#> 2 Bachelor's degree in college (4-year) 15
#> 3 Doctoral degree 19
#> 4 High school graduate (high school diploma or equivalent including GED) 16
#> 5 Less than high school degree 12
#> 6 Master's degree 20
#> 7 Professional degree (JD, MD) 17
#> 8 Some college but no degree 15 Created on 2021-11-09 by the reprex package (v2.0.1) That should get you labels but not try to convert them to an ordered factor. It will not be a factor, but rather a character; if you want to convert it to an unordered factor, you could do that afterwards. |
Thank you @juliasilge . I thought there is a way to do it at once - convert to factor without ordering in a single step at import. |
I don't believe currently. We have this longstanding comment about adding support for something like Line 486 in 6e64d2c
But it is not currently possible. You can either do the ordered factor based on your |
Hi,
is it possible to pass a
ordered = FALSE
flag tofetch_survey()
along withconvert = T, label = T
?The reason I'm asking is, that I only need labels for my factor columns and it looks as if ordering is not working for some reason with my survey.
Variables that are originally 7 level (properly recoded on qualtrics side) produce errors
and get imported as
NAs
only:While, actually there should be responses:
df<-fetch_survey("SV_6fj5q4AwIjhOU0m", time_zone = "Europe/Berlin", force_request = T,
start_date = "2021-11-01", convert = F, label = F, include_display_order = F)
The text was updated successfully, but these errors were encountered: