pullsg: Download survey response data from Survey Gizmo, storing an R...

Description Usage Arguments

Description

This function downloads a survey's response data from Survey Gizmo (SG), saving the returned data as an R data.frame. Because SG limits the size of JSON data pulls via the API (currently, the limit is 250), it calculates the number of pulls needed to download the entire response set and binds the returned frames. To ensure that variable names are interpretable in the returned data frame, it is strongly recommended that users first assign question aliases to each question prior to utilizing this function.

Usage

1
2
3
4
pullsg(surveyid, api, completes_only = TRUE, verbose = TRUE,
  var_name_append = TRUE, mergecampaign = FALSE, delete_sys_vars = FALSE,
  keep_geo_vars = TRUE, clean = FALSE, reset_row_names = TRUE,
  small = FALSE)

Arguments

surveyid

The survey's unique SG ID number (in V4 of the API, the portion of the surveyresponse call URL which follows "id/", e.g.: "...build/id/1234567"

api

The user's private API key for Survey Gizmo

completes_only

When true (the Default), survey responses with a status of "Complete" are saved. Responses with a status of "disqualified", "partial", etc. are deleted (see this link for documentation)

verbose

When true (the default), download progress is printed to standard output.

var_name_append

When true (the default), appends the stub "_ID[question_numer] to questions without an alias to avoid variable name conflicts.

mergecampaign

When true, contact emails are downloaded from the SG "contact" object and merged with the survey responses. Note: this parameter should only be used with survey projects that have an active email campaign.

delete_sys_vars

When true, deletes SG system variables (i.e., fields of the form [[variable(...)]] that do not contain question responses. NOTE: When set to false, pullsg will change the stub of SG system variables to sys_* See this link for more information about fields returned by SG via the API).

keep_geo_vars

When true (the default), SG's geographic variables (lat/long, city, etc.), which are estimated using the respondent's IP address, are preserved in the returned data.frame. This option also changes the name of the geographic variables to:

  • rsp_lng

  • rsp_lat

  • rsp_cntr

  • rsp_city

  • rsp_regi

  • rsp_post

clean

This option performs three transformations to the returned data.frame:

  1. attempts to coerce vectors to numeric if all values are numbers or "" (uses type.convert)

  2. sets 'delete_sys_vars' to true

  3. removes other non-survey-question variables returned by the Survey Gizmo API, including: "contactid", "istestdata", "sessionid", "language", "ilinkid", and "sresponsecomment" (as of V4 of the SG API)

reset_row_names

When true (the default), resets row names to 1, 2,..N in the returned dataframe

small

Only merge email address when mergecampaign is true.


acwagnerucd/Rsurveygizmo2 documentation built on May 16, 2019, 6:56 p.m.