svy_df: Create a survey data frame

Description Usage Arguments Details Value

Description

A survey data frame that employs the same generic methods as a regular data.frame with additional functionality for preserving levels and question text attributes for columns.

Usage

1
2
3
4
5
6
svy_df(data, questions = NULL)

is.svy_df(x)

## S3 method for class 'svy_df'
print(x, ..., n = NULL, width = NULL)

Arguments

data

a data frame

questions

a data frame with a minimum of two columns, where the first column contains matching names of columns in data and the second column contains the associated full question text.

x

An object to test or print.

n,width,...

Arguemnts passed to print.

Details

Each column of a svy_df generally represents a question from a opinion survey, where the values represent unique response choices, variable levels represent the response choice text, and the question text represents the full wording of the survey item as displayed to the respondent. Each row represents a unique respondent.

When subsetting a svy_df object using standard indexing methods (i.e. '['), variable levels and question text will be copied from the original object to the subsetted object using copy_lev.

Value

A object of class svy_df with optional attributes for question text and variable levels.


alexdulin/MCmrp documentation built on May 11, 2019, 11:29 p.m.