Closed Haunfelder closed 5 months ago
@jmobrien do you mind taking a look at this, to see what you think? I don't think I've done much with variableNames
in my real work.
If it helps, here's some more details about the error. I'm fetching a survey that has a multiple choice question with recoding as described in the issue. I use the following code,
test = fetch_survey(surveyID = surveyID, label = T, convert = T,
verbose = T, force_request = T)
which results in the following warning.
The values of the variable all are set to NA because the factor levels do not match the values returned by the survey API. Here's a picture of the problems output,
The expected value is "Tenure or Tenure-track Professor", but the actual value returned from the API is "tenure or tenure-track professor".
I think you'll be able to re-create the issue with a single question survey that uses recoding and variable names, but let me know if you need any more details.
Sure. I glanced at it earlier--this makes sense and could likely be a good change, but I should do some testing across a few setups. I seem to recall some idiosyncrasies around this part of the metadata() endpoint. Can't recall exactly, but I think it might have had something to do with whether/how it respected the checkbox for these. So, there are some use cases we'll want to check first (like if people populate these fields, but then turn them off)
On Wed, May 8, 2024 at 8:06 PM Julia Silge @.***> wrote:
@jmobrien https://github.com/jmobrien do you mind taking a look at this, to see what you think? I don't think I've done much with variableNames in my real work.
— Reply to this email directly, view it on GitHub https://github.com/ropensci/qualtRics/pull/343#issuecomment-2101742295, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABWEMIXHT2AKTGSWYGAY6DDZBLD2NAVCNFSM6AAAAABHN2IU7CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMBRG42DEMRZGU . You are receiving this because you were mentioned.Message ID: @.***>
Awesome, thanks @juliasilge! I appreciate you all taking the time to understand the issue I was seeing. The qualtRics package has been very useful for me!
If variableNames are non-null, use them for factor levels, otherwise use the choiceText. It may be more appropriate to add an explicit flag to the function to not cause any issues with people relying on choiceText. From my testing, all cases where variableNames do not match choiceText causes an error in fetch_survey as explained in the issue.
Fixes #342