Created
March 3, 2015 05:04
-
-
Save SolomonMg/4043e15691756071b1ad to your computer and use it in GitHub Desktop.
Read in data from Qualtrics to R (adapted from qualtrics R package - http://jason.bryer.org/qualtrics/)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(RCurl) | |
getSurveyResults <- function (username, | |
token, surveyid, truncNames = 20, | |
Questions = NULL, | |
Labels = "1", | |
ExportTags = "1", | |
LocalTime = "1", | |
startDate = NULL, endDate = NULL) { | |
url = paste( | |
"https://survey.qualtrics.com/WRAPI/ControlPanel/api.php?Request=getLegacyResponseData&User=", | |
username, | |
"&Token=", token, | |
"&SurveyID=", surveyid, | |
"&Version=2.0", | |
"&Labels=", Labels, | |
"&ExportTags=", ExportTags, | |
"&LocalTime=", LocalTime, | |
"&Format=CSV", | |
sep = "") | |
print(url) | |
urlcontents <- getURL(url) | |
urlcontents <- gsub("<ef><bb><bf>", "", urlcontents) | |
urlcontents <- strsplit(urlcontents, "\\n")[[1]] | |
dat <- read.csv(text=urlcontents[-1]) | |
dat$X = NULL | |
dat | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment