The goal of rEvalKit is to hasten data extraction from the EvaluationKit REST API.
rEvalKit is not on CRAN, but you can install the package with devtools:
devtools::install_github("daranzolin/rEvalKit")First, obtain an API key by contacting EvaluationKit. Second, set your domain and key with the two helper functions below. These values will get written to your .Rprofile.
library(rEvalKit)
ek_set_token("YOUR_TOKEN_HERE")
ek_set_domin("YOUR_DOMAIN_HERE")ek_accountsek_course_rawdataek_coursesek_project_coursesek_project_nonrespondentsek_project_rawdataek_project_respondentsek_project_usersek_projectsek_response_ratesek_survey_questionsek_surveysek_termsek_users
ek_project_rawdata will throw a 422 status error if the specified project is not a "General Survey Project". A workaround is to collect the raw data from each course like so:
projects <- ek_projects()
safe_get_ek_data <- safely(ek_course_rawdata)
get_project_data_safe_list <- function(projectId) {
courses <- try(ek_project_courses(projectId), silent = TRUE)
if (inherits(courses, "try-error")) return(NULL)
list_args <- list(
projectId = projectId,
courseId = courses$id
)
pmap(list_args, safe_get_ek_data)
}
all_raw_data <- projects$id %>%
map(get_project_data_safe_list) %>%
map_df("result")