ropensci / qualtrics Goto Github PK
View Code? Open in Web Editor NEWDownload ⬇️ Qualtrics survey data directly into R!
Home Page: https://docs.ropensci.org/qualtRics
License: Other
Download ⬇️ Qualtrics survey data directly into R!
Home Page: https://docs.ropensci.org/qualtRics
License: Other
When I tried to initialize the registerOptions, it pops up "Error: assert_that: assertion must return a logical value"
Code:
registerOptions(api_token="[token with length of 40]",
root_url="mit.co1.qualtrics.com")
Thanks!
When importing survey data into R, is there a delay between what is current in the Qualtrics system and what is being downloaded?
Is it possible that the data is having problems importing? I enter the following into R:
loyperc <- getSurvey("SV_5nIBD5iRalXmdNz", useLabels=FALSE, useLocalTime=TRUE, dateWarning=FALSE, convertStandardColumns=TRUE, force_request=TRUE)
I get the following warning:
Warning message: In scan(file = file, what = what, sep = sep, quote = quote, dec = dec, : invalid input found on input connection 'C:/Users/cb37543/AppData/Local/Temp/RtmpeEgLjr/Loyalty perceptions (Jamie).csv'
I can only import 88 observations, when there is actually much more than this.
I ran into an error when trying to use registerOptions() to configure my qualtrics account. I tried to both specify the API token and root_url within the function or use the yml file in the working directory.
The error seems to be related to the assert_that() function. Below is the error.
Error: assert_that: assertion must return a logical value
stop("assert_that: assertion must return a logical value", call. = FALSE)
check_result(res)
see_if(..., env = env)
assertthat::assert_that(!is.na(root_url) | Sys.getenv("QUALTRICS_ROOT_URL") != "", msg = "'root_url' parameter must either be specified in the .qualtRics.yml configuration file or passed to the 'registerOptions' function. To view an example of a configuration file, execute 'qualtRicsConfigFile()'.")
I didn't have an issue of configuring my account when I use the same token and URL
Let me know if you need any other info, thanks!
Error in qualtRicsResponseCodes(res) :
Qualtrics API raised a bad request (400) error - Please report this on https://github.com/JasperHG90/qualtRics/issues
I get the error with both the main package and development version. Was working fine before I updated today, I think the last time I downloaded was late December. getSurveys
works as intended.
Currently:
Possibly:
R newbie here.
Made changes to the survey in Qualtrics, changes not observed when I run the script in R. Is there a lag between making updates in Qualtrics and downloading the data using this package?
Jasper,
I really appreciate the work you have provided for us in this package. It is a wonderful tool. It would be a great help if it was possible to have either the datetime or last survey id retained in qualtRics or the .yml at the the end of a download of a specific survey so it could be added to a new getsurvey request. This would work great with scheduled downloads so only new responses were download. We collect responses from our surveys daily or weekly and this would allow the process to be automated without downloading all the responses again.
Thanks for considering this.
Delkine
Hi Jasper,
It seems the getSurveys option stops at 100 observations. Is it possible to adjust this? We have a lot more, and I also don't know how it selects the 100 that do show up.
Kind regards, Daniël
Hi Jasper,
Thanks for building this package for us R users.
I was wondering if there are any plans to implement a way to get contact list to a particular survey?
Sincerely,
Kai
Thank you for Providing qualtRics to download survey information and responses. It is really a great tool. I've recently started getting this "Warning message:
This function will be removed in future versions of sjmisc and has been moved to package 'sjlabelled'. Please use sjlabelled::set_label() instead."
How will this affect how we use qualtRics? Will we need to do something different when downloading survey responses?
Thank you!
Now, user must fill out multiple base urls. This is confusing.
In the Vignette, under Commands, the example documentation for getSurveys() should have a URL that ends with '/v3/surveys' rather than '/v3/responseexports/'.
Hey Jasper. I am very eager and excited to try out the qualtrics API integration package. However, I am stuck on step 1. I run the following code with my token and institution url:
registerOptions(api_token = "my-api-token",
root_url = "montclair.co1.qualtrics.com")
But it throws the error:
Error: assert_that: assertion must return a logical value
I have tried with config file and changing the url, but I continue receiving this error. I feel like I'm missing something obvious.
When using the getSurvey function I get the following error for one particular survey:
Error in read.table(file = file, header = header, sep = sep, quote = quote, :
more columns than column names
I don't know how to debug this error. Any suggestions?
The default setting of true for useLabels pulls question response labels and not values, which can make some survey data harder to analyze. It would be useful to be able to choose whether the labels are outputted or not whenever the getSurvey function is run.
It is also useful to only export survey data from certain dates, and arguments for startDate and endDate would be helpful.
Thanks!
Japser,
After almost 2 weeks of error free use of script I'm now repeatedly getting a bad request (400) error when it is run. The script is unchanged. Has anything changed with qualtRics or with the API that would cause this error to be raised now? Do you need to see the whole script or part of the script?
Delkine
Please add a "seenUnansweredRecode" option as a string parameter to the getSurvey() function.
When saving a rds file through the getSurvey function, could you add an option to append the date/time to the filename.
Beginning Saturday I began experiencing problems running qualtRics that I had never seen before. I checked your documentation and it looks like you have implemented some new features and made several changes. It looks like the changes will be nice improvements but for now I'm having issues that I can't find any documentation about. I installed your latest version of qualtRics. I have created registerOptions () file and placed it in my wd. When I run my whole script I get several errors. It appears that the regiserOptions file is not being read. When I put enter my API token and root_url directly in the registerOptions() command it seems to work now.
Using the config file option the print out in the console datewarning option does NOT have the capitalized W as seen in your vignette. This spits an error saying the last line is unclear.
I was terminated my R terminal and now I am receive the following error:
Error: package or namespace load failed for ‘qualtRics’:
.onLoad failed in loadNamespace() for 'qualtRics', details:
call: yaml.load(paste(readLines(input, encoding = "UTF-8"), collapse = "\n"),
error: Scanner error: while scanning a simple key at line 4, column 1could not find expected ':' at line 5, column 1
Any ideas?
In #57 , Erulluvatar set file encoding to be UTF-8. While this is correct for current surveys, legacy files do not use this format. If I remember correctly, it also gives issues for special characters.
Perhaps the best thing to do is to write a little part about it in the README. I can't really test this myself anymore because ironically I don't have a qualtrics account. But if anyone can test special characters for me that'd be great!
Trying to install the 'qualtRics' package, but received the error that this package is not available for R version 3.3.2. Any advice on navigating this issue would be helpful.
Thanks in advance. –Chris
It would be great to also have a column showing the question label for each item.
I.e., include:
QID
Question Label
Question Text
This is a really handy function - thanks!
Hi Jasper,
Is there an option to get either or both numeric value vs choice text responses?
Thanks,
Kai
We found that surveys that use new lines in the questions break the readSurvey function.
The problem is, that read.csv (and read.table as well as the readr library implementation) ignore the quote = "\""
option when a skip = 2
or skip = 3
parameter is set.
As a result the read function slices off the questions row somewhere in the middle when first importing just the table body using skip
.
Do you have any idea how to circumvent that?
One workaround is to export the csv using the "strip new lines" option in qualtrics.
So if this is the only way to handle the situation, we should put that in the Readme.
registerApiKey("mytoken")
[1] TRUE
surveys <- getSurveys(root_url="https://ohio.qualtrics.com")
Error in do.call(rbind.data.frame, content(res)$result$elements) :
second argument must be a list
Any idea what could be going on here, Jasper?
When I run my script following your examples from Rstudio I have no problem getting the script to run and create a *.csv file with the responses to my survey. However when I try to automate its execution and run it from taskscheduleR as an Addin called from Rstudion I get the following error message in the log file and I get no output. Can you help me fix this. Other scripts I run work just fine using the same process.
"Installing package into 'C:/Users/del/Documents/R/win-library/3.4'
(as 'lib' is unspecified)
Error in contrib.url(repos, "source") :
trying to use CRAN without setting a mirror
Calls: install.packages -> contrib.url
Execution halted"
Thank you!
Del
Better error handling in following situations:
User executes getSurveys()
before registering any options
If a user loads library & doesn't have a config file, and the user then calls 'getSurveys()' straight away (without registering options), the user will see an unclear error because code contains ifelse
statements. Best set options when library is loaded. These will then be overwritten straight after but that's OK.
Incomplete final line
#37 notified that readLines
throws error if .qualtRics.yml does not contain empty line at the end of file (on Windows). Consider turning qualtRicsConfigFile()
into function that writes configuration file for user.
Hi Jasper,
I started to play your package. I used registerApiKey function to register my API and made sure it returned 'TRUE'. However, when i followed steps on vignette and tried to download one specific survey with its survey ID found in the account setting-Qualtrics IDs. It returned the below error:
Query returned status "401 - Unauthorized". Please check your code.
Can you add a user credential argument in your getsurveys functions. Thank you!
Not sure if this already exists, but is it possible to use the export tags set in Qualtrics instead of the long field name as the column headers?
Hi Jasper,
I tried to getSurvey from my qualtrics, but got the following error message. My platform is Windows 10 Professional Simplified Chinese. The same code works under Ubuntu 16.04 LTS. So I guess it's probably an encoding issue.
Thanks.
Best,
Sean
mysurvey.2 <- getSurvey(surveyID = surveys$id[2])
|======================================================================================| 100%
Error in read.table(file = file, header = header, sep = sep, quote = quote, :
no lines available in input
In addition: Warning messages:
1: In readLines(file, skip) :
invalid input found on input connection '.../China Survey.csv'
2: In readLines(file, skip) :
incomplete final line found on '.../China Survey.csv'
Currently, the API key needs to be registered every session. The key is then saved in a temporary directory which gets deleted after the R session is terminated.
According to CRAN policies, R packages cannot change files on-disk. Specifically, this:
Packages should not write in the users’ home filespace, nor anywhere else on the file system apart from the R session’s temporary directory (or during installation in the location pointed to by TMPDIR: and such usage should be cleaned up). Installing into the system’s R installation (e.g., scripts to its bin directory) is not allowed.
But I'd like to save the results of the registerApiKey function to a local file because it makes the whole process a lot easier and prevents users from accidentally sending API keys along with R scripts. Perhaps create a separate data file with a placeholder file as a standard part of the package (i.e. a data set).
When downloading surveys, user will always get this error:
Error in file(file, "rt") : invalid 'description' argument In addition: Warning message: In unzip(tf, exdir = tempdir()) : error 1 in extracting from zip file
I've used qualtRics 1.0
without issue (and really like the R API!). Yesterday, when setting up a co-worker's computer, I noticed 2.0 is out on CRAN. I adapted the code I had used for qualtRicsConfigFile
and created the .qualtRics.yml
file as instructed into a new plain text file with Notepad (Windows machine). Unfortunately, when I ran registerOptions
it threw an error: incomplete final line
. So, it found the file OK but presumably hit a harmless error on readLines
. Fortunately I was able to download the data by reading through registerOptions
and setting the relevant options and environment variables.
Sys.setenv(QUALTRICS_ROOT_URL = "https://someorganization.qualtrics.com")
Sys.setenv(QUALTRICS_API_KEY = "ASDFqwertyNOTanAPIkey")
options(QUALTRICS_VERBOSE = T, QUALTRICS_USELABELS = T,
QUALTRICS_CONVERTSTANDARDCOLUMNS = T,
QUALTRICS_USELOCALTIME = F)
Maybe it's just a notepad issue, not sure. Wanted to let you know. Wonder if it wouldn't be easier to generate the yml
file for the user...
I'm receiving the following warning when I us qualtRics to download a survey.
"Warning message:
In scan(file = file, what = what, sep = sep, quote = quote, dec = dec, :
invalid input found on input connection 'C:/Users/del/AppData/Local/Temp/RtmpQZ7nvM/Mindshare English v21.csv'"
Can you point me some help with this? I'm also not getting all the respondent surveys in the download.
Del
E.g. which steps to take.
User must:
Add to README. This is important for data integrity. See email John.
This code has worked for quite a while but now throws a 400 error. Here is a snippet of the code where the error shows up.
surveys <- getSurveys()
#####---------------------------------------------------------------------------------------------------------
#####---------------------------------------------------------------------------------------------------------
lastid1.rds <-"R_2D5NheqdikcY0p2" ## Replace ResponseID with chosen ResponseID when it is known.
lastid2.rds <-lastid1.rds
#####---------------------------------------------------------------------------------------------------------
mysurvey <- getSurvey(surveyID = surveys$id[9],
save_dir = "/users/del/dropbox/Polynesian_Cultural_Center/Shared_PCC/Qualtrics_Data/",
lastResponseId = lastid2.rds,
verbose=TRUE,
uselabels=FALSE,
force_request = TRUE)
Error in qualtRicsResponseCodes(res, raw = raw) :
Qualtrics API raised a bad request (400) error - Please report this on https://github.com/JasperHG90/qualtRics/issues
#####-------------------------
Any suggestions?
Sometimes I build a project survey and then I want to use the same survey for a different group or project. It can get tedious to point an click. Thanks.
Just wondering if you have seen this error/ warning message before.
Do you know what it is? Do I need to fix it?
Sincerely,
W Christopher King
Polynesian Cultural Center
[email protected]
|=================================================================| 100%
Warning message:
In scan(file = file, what = what, sep = sep, quote = quote, dec = dec, :
invalid input found on input connection 'C:/Users/SDR-RE~1/AppData/Local/Temp/Rtmpgre0N8/Mindshare English v21.csv'
Hi
Thanks for the great package.
getSurveys()
keeps telling me
Qualtrics API raised an authentication (401) error - you may not have the required authorization. Please check your API key and root url.
Well, obviously that seems (and most likely is) very stupid of me. However, I followed the documentation and registered using:
registerOptions(api_token="MYTOKEN", root_url="ROOTURL")
I also consulted the API Docs of Qualtrics and can't come up with a different rooturl... Do you have any advice on this?
Thanks in advance.
Tom
Lines 96-102
Hi Jasper,
Thanks for creating this tool.
Is it possible to avoid the API Number or get around it? I would love to be able to use this but my organization does not have access to our API numbers in the Qualtrics platform, thus limiting my ability to use this tool.
Thank you.
Neil
For consistency.
Hi,
I'm having an issue with qualtRics where when I run my script to download results of a survey to a specified directory, I get the error message below:
Warning message:
In scan(file = file, what = what, sep = sep, quote = quote, dec = dec, :
invalid input found on input connection '/tmp/RtmpVQGNZ1/<my_survey_name>.csv'
What is odd is that this is not the folder I indicate to save the file to, and I only get 14 rows of data read (out of ~1500).
I have changed the permissions of that folder, thinking that may help, and it hasnt.
If I put NULL in save_dir, I still get the same error.
Thanks in advance!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.