Skip to content
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

fetch_survey error: Error in mutate_impl(.data, dots) : Evaluation error: is.character(x) is not TRUE. #114

Closed
DeFilippis opened this issue Apr 30, 2019 · 6 comments

Comments

@DeFilippis
Copy link

DeFilippis commented Apr 30, 2019

I'm getting the following error when trying to import any qualtrics survey:

df <- fetch_survey(surveyID = "SV_0BYv2PmXgjW6szX",  
                       useLocalTime = TRUE, 
                       force_request = TRUE, 
                       uselabels = TRUE)

Error in mutate_impl(.data, dots) :
Evaluation error: is.character(x) is not TRUE.

Problem persists if doing it like so:

survey_info <- all_surveys()
df <- fetch_survey(surveyID = survey_info$id[14],  
                       useLocalTime = TRUE, 
                       force_request = TRUE, 
                       uselabels = FALSE)

Seems like nobody else has had a similar error. Any ideas?

@juliasilge
Copy link
Collaborator

Thanks so much for checking in with this problem @DeFilippis ! 🙌

This is actually related to a similar problem other folks are having with how readr::read_csv() is used under the hood here. I would love to dig in to find out what is happening here.

Can you run the following code and then email me (my address is in the DESCRIPTION file) the CSV file at the path you find? It will be a fairly raw, unprocessed CSV file, but that is the one that is causing problems with readr::read_csv(), apparently!

root_url <- qualtRics:::append_root_url(Sys.getenv("QUALTRICS_BASE_URL"), "responseexports")
raw_payload <- qualtRics:::create_raw_payload(
    surveyID = <YOUR SURVEY ID HERE>,
    label = TRUE,
    last_response = NULL,
    start_date = NULL,
    end_date = NULL,
    unanswer_recode = NULL,
    limit = NULL,
    local_time = FALSE,
    include_questions = NULL
  )
res <- qualtRics:::qualtrics_api_request("POST", url = root_url, body = raw_payload)
ID <- res$result$id
survey.fpath <- qualtRics:::download_qualtrics_export(paste0(root_url, ID), verbose = TRUE)
survey.fpath

@juliasilge
Copy link
Collaborator

I've been doing a bit more digging into this @DeFilippis and am starting to suspect the function that does conversion of data types.

Are you still getting this error, after updating to the latest versions on CRAN of tidyverse and qualtRics? Can you tell me if you get the error with both or just one of the following ways of using this package?

survey1 <- fetch_survey(surveyID = <YOUR SURVEY ID>, convert = TRUE)
survey2 <- fetch_survey(surveyID = <YOUR SURVEY ID>, convert = FALSE)

@DeFilippis
Copy link
Author

DeFilippis commented May 13, 2019 via email

@juliasilge
Copy link
Collaborator

OK, this means that the error is coming from the infer_data_types() function, which I will now set aside some time to fix.

Thank you so much for checking! 🙌

@juliasilge
Copy link
Collaborator

Today I rewrote infer_data_types() in a way that I hope solves this problem. 🤞

Do you want to try installing this package from GitHub and then using fetch_survey() with convert = TRUE? You should no longer see the error.

remotes::install_github("ropensci/qualtRics")

@juliasilge
Copy link
Collaborator

I believe this error is now fixed in the development version. File a new issue with details if you still are having problems! ✨

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants