ropensci / qualtRics

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

fetch_survey tmpdir problem in 3.2.1? #354

Closed pgmj closed 4 days ago

pgmj commented 2 weeks ago

Package version 3.2.0 works perfectly for retrieving data, but 3.2.1 fails with identical code with this error message:

Error: '/var/folders/yf/q87d8g990l5f_sz039gjgmy80000gn/T/RtmpTiIVMj/name of my Qualtrics project.csv' does not exist.

I have tried to change the tmpdir, but get the same error. Downgraded to 3.2.0 and things work again, in the same R session.

juliasilge commented 1 week ago

We did make some changes to how the temp directory is found/handled in the 3.2.1 release, as outlined in #349 and the issues linked there. It has solved that whole class of bugs but sounds like you are running into a related problem.

Can you share a reprex like this of your failing call to fetch_survey()?

library(qualtRics)

res <- fetch_survey("SV_8333HU7pajrPy0C")
#>   |                                                                              |                                                                      |   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 = ""),
#>   SolutionRevision = col_double(),
#>   OverallBenefits_DO_OB4 = col_double(),
#>   OverallBenefits_DO_OB1 = col_double(),
#>   OverallBenefits_DO_OB2 = col_double(),
#>   OverallBenefits_DO_OB3 = col_double(),
#>   WorkplaceBenefits_DO_WB2 = col_double(),
#>   WorkplaceBenefits_DO_WB1 = col_double()
#> )
#> ℹ Use `spec()` for the full column specifications.
dplyr::glimpse(res)
#> Rows: 26
#> Columns: 28
#> $ StartDate                <dttm> 2024-07-30 11:10:31, 2024-07-30 11:10:31, 20…
#> $ EndDate                  <dttm> 2024-07-30 11:10:31, 2024-07-30 11:10:31, 20…
#> $ Status                   <chr> "Survey Test", "Survey Test", "Survey Test", …
#> $ Progress                 <dbl> 100, 100, 100, 100, 100, 100, 100, 100, 100, …
#> $ `Duration (in seconds)`  <dbl> 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, …
#> $ Finished                 <lgl> TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRU…
#> $ RecordedDate             <dttm> 2024-07-30 11:10:31, 2024-07-30 11:10:31, 20…
#> $ ResponseId               <chr> "R_57Peg8bMlfbnU90", "R_09tMxb83zFWJnMi", "R_…
#> $ DistributionChannel      <chr> "test", "test", "test", "test", "test", "test…
#> $ UserLanguage             <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N…
#> $ OB1                      <ord> Strongly disagree, Slightly disagree, Slightl…
#> $ OB2                      <ord> Strongly disagree, Slightly agree, Slightly d…
#> $ OB3                      <ord> Strongly agree, Slightly disagree, Slightly d…
#> $ OB4                      <ord> Strongly agree, Neutral, Slightly agree, Slig…
#> $ WB1                      <ord> Very dissatisfied, Very dissatisfied, Very sa…
#> $ WB2                      <ord> Slightly satisfied, NA, Very satisfied, Very …
#> $ Q14                      <chr> "Posuere interdum tempor scelerisque sed mole…
#> $ Q10                      <ord> Prefer not to say, Female, Male, Female, Pref…
#> $ Q11                      <chr> "Over 80", "Under 21", "31 to 40", "51 to 60"…
#> $ SolutionRevision         <dbl> 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, …
#> $ ProjectCategory          <chr> "EX", "EX", "EX", "EX", "EX", "EX", "EX", "EX…
#> $ ProjectType              <chr> "BenefitsPerks", "BenefitsPerks", "BenefitsPe…
#> $ OverallBenefits_DO_OB4   <dbl> 2, 1, 3, 4, 3, 1, 4, 3, 1, 1, 1, 3, 1, 1, 3, …
#> $ OverallBenefits_DO_OB1   <dbl> 3, 2, 4, 1, 2, 2, 3, 4, 3, 4, 2, 2, 3, 3, 2, …
#> $ OverallBenefits_DO_OB2   <dbl> 4, 4, 1, 3, 1, 4, 1, 1, 2, 2, 3, 1, 4, 4, 1, …
#> $ OverallBenefits_DO_OB3   <dbl> 1, 3, 2, 2, 4, 3, 2, 2, 4, 3, 4, 4, 2, 2, 4, …
#> $ WorkplaceBenefits_DO_WB2 <dbl> 2, 1, 1, 2, 1, 1, 2, 2, 1, 1, 2, 1, 1, 2, 2, …
#> $ WorkplaceBenefits_DO_WB1 <dbl> 1, 2, 2, 1, 2, 2, 1, 1, 2, 2, 1, 2, 2, 1, 1, …

Created on 2024-09-02 with reprex v2.1.1

It should show the full traceback, which will be helpful. Also, if you can do reprex::reprex(session_info = TRUE) that may be helpful in this situation.

pgmj commented 1 week ago

Thanks! This is all output I get:

> mysurvey <- fetch_survey(surveyID = q$id[2])
  |==========================================================================================================================================================| 100%
Error: '/var/folders/yf/q87d8g990l5f_sz039gjgmy80000gn/T/RtmpWCl3wO/Att leda på avstånd.csv' does not exist.

The name of the .csv file is the full name of the survey in the Qualtrics system.

reprex::reprex(session_info = TRUE)
#> ℹ Non-interactive session, setting `html_preview = FALSE`.
#> CLIPR_ALLOW has not been set, so clipr will not run interactively
#> Error in switch(where, expr = stringify_expression(x_expr), clipboard = ingest_clipboard(), : EXPR must be a length 1 vector

Created on 2024-09-03 with reprex v2.1.1

Session info ``` r sessioninfo::session_info() #> ─ Session info ─────────────────────────────────────────────────────────────── #> setting value #> version R version 4.4.1 (2024-06-14) #> os macOS Sonoma 14.6.1 #> system aarch64, darwin20 #> ui X11 #> language (EN) #> collate en_US.UTF-8 #> ctype en_US.UTF-8 #> tz Europe/Stockholm #> date 2024-09-03 #> pandoc 3.1.11 @ /Applications/RStudio.app/Contents/Resources/app/quarto/bin/tools/aarch64/ (via rmarkdown) #> #> ─ Packages ─────────────────────────────────────────────────────────────────── #> package * version date (UTC) lib source #> cli 3.6.3 2024-06-21 [1] CRAN (R 4.4.0) #> clipr 0.8.0 2022-02-22 [1] CRAN (R 4.4.0) #> digest 0.6.36 2024-06-23 [1] CRAN (R 4.4.0) #> evaluate 0.24.0 2024-06-10 [1] CRAN (R 4.4.0) #> fastmap 1.2.0 2024-05-15 [1] CRAN (R 4.4.0) #> fs 1.6.4 2024-04-25 [1] CRAN (R 4.4.0) #> glue 1.7.0 2024-01-09 [1] CRAN (R 4.4.0) #> htmltools 0.5.8.1 2024-04-04 [1] CRAN (R 4.4.0) #> knitr 1.48 2024-07-07 [1] CRAN (R 4.4.0) #> lifecycle 1.0.4 2023-11-07 [1] CRAN (R 4.4.0) #> reprex 2.1.1 2024-07-06 [1] CRAN (R 4.4.0) #> rlang 1.1.4 2024-06-04 [1] CRAN (R 4.4.0) #> rmarkdown 2.27 2024-05-17 [1] CRAN (R 4.4.0) #> rstudioapi 0.16.0 2024-03-24 [1] CRAN (R 4.4.0) #> sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.4.0) #> withr 3.0.1 2024-07-31 [1] CRAN (R 4.4.0) #> xfun 0.46 2024-07-18 [1] CRAN (R 4.4.0) #> yaml 2.3.10 2024-07-26 [1] CRAN (R 4.4.0) #> #> [1] /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library #> #> ────────────────────────────────────────────────────────────────────────────── ```
juliasilge commented 1 week ago

Ah, thanks for sharing the real filename you have there! I changed the name of this survey and can reproduce the problem:

library(qualtRics)

res <- fetch_survey("SV_8333HU7pajrPy0C")
#>   |                                                                              |                                                                      |   0%  |                                                                              |======================================================================| 100%
#> Error: '/var/folders/hv/hzsmmyk9393_m7q3nscx1slc0000gn/T/RtmpjRnn5G/new: sůrvey! åbõut? ~benefits~.csv' does not exist.

Created on 2024-09-04 with reprex v2.1.1