sm_response_list: Parse responses to dataframe

Description Usage Arguments Details Value Author(s) Examples

Description

Parse responses to a data.frame using a sm_surveydetails object.

Usage

1
2
3
4
## S3 method for class 'sm_response'
as.data.frame(x, row.names, optional, details = NULL, stringsAsFactors = FALSE, ...)
## S3 method for class 'sm_response_list'
as.data.frame(x, row.names, optional, details = NULL, stringsAsFactors = FALSE, ...)

Arguments

x

An object of class sm_response or sm_response_list.

row.names

Ignored.

optional

Ignored.

details

If NULL, the method looks for a “survey_id” attribute in x. Otherwise, details must be supplied as an object of class sm_surveydetails or a survey ID number (possibly returned by surveylist). The first and third of these possibilities will trigger (and therefore require) a surveydetails request.

stringsAsFactors

Whether to create factor variables when creating the resulting data.frame. There should be no situation where this needs to be TRUE.

...

Other arguments. Currently ignored.

Details

Parses an sm_response object, or list of such objects, into a dataframe using a sm_surveydetails object to structure the result.

Value

A data.frame. Variable names are based upon the Survey Monkey internal question_id numbers. Question wordings are stored in a “question” attribute in each variable. The question wordings can also be extracted from a “sm_surveydetails” object using surveyquestions. The user will have to manually rename variables.

Author(s)

Thomas J. Leeper

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Not run: 
smlogin()
s <- surveylist()
r <- respondentlist(s[[1]])

# get all responses (up to 100)
a <- getresponses(r)
as.data.frame(a)

## End(Not run)

cloudyr/Rmonkey documentation built on May 13, 2019, 8:17 p.m.