Overview

surveydata-package

Tools, classes and methods to manipulate survey data.

membersurvey

Data frame with survey data of member satisfaction survey.

Coercion functions

Coerces various objects to a surveydata object

as.data.frame(<surveydata>)

Coerces surveydata object to data.frame.

as.surveydata() un_surveydata()

Coercion from and to surveydata.

is.surveydata()

Tests whether an object is of class surveydata.

Access and modify attributes

pattern() `pattern<-`()

Returns and updates pattern attribute.

varlabels() `varlabels<-`()

Returns and updates variable.labels attribute of surveydata object.

Subset or merge surveydata objects

merge(<surveydata>)

Merge surveydata objects.

`[`(<surveydata>) `[<-`(<surveydata>) `$<-`(<surveydata>)

Extract or replace subsets of surveydata, ensuring that the varlabels stay synchronized.

cbind(<surveydata>)

Combines surveydata object by columns.

To extract question text from varlabels

question_order()

Changes vector to ordered factor, adding NA levels if applicable.

question_text()

Returns question text.

question_text_common()

Returns common element of question text.

question_text_unique()

Returns unique elements of question text.

questions()

Returns a list of all the unique questions in the surveydata object.

survey_plot_question()

Plots single and as multi-response questions.

which.q()

Identifies the columns indices corresponding to a specific question.

split_common_unique()

Get common and unique text in question based on regex pattern identification.

strCommonUnique()

Finds the common and unique elements in a character vector.

To fix common encoding problems

fix_common_encoding_problems()

Fix common encoding problems when working with web imported data.

encToInt()

Converts a character vector to an integer vector.

intToEnc()

Converts an integer vector to a character vector.

To clean data

remove_all_dont_know()

Removes "Do not know" and other similar words from factor levels in data frame.

remove_dont_know()

Removes "Don't know" from levels and replaces with NA.

fix_levels_01_spss() fix_levels_01_r() fix_levels_01()

Fix level formatting of all question with Yes/No type answers.

has_dont_know()

Tests whether levels contain "Don't know".

leveltest_spss() leveltest_r()

Fix level formatting of all question with Yes/No type answers.

Plot functions

survey_plot_question()

Plots single and as multi-response questions.

survey_plot_satisfaction()

Plot satisfaction questions.

survey_plot_title()

Construct plot title from the question text, wrapping at the desired width.

survey_plot_yes_no()

Plot data in yes/no format.

Work with open text response data

as_opentext_datatable()

Converts free format question text to datatable using the DT package.

print_opentext()

Print open text questions.

Miscellaneous tools

dropout()

Calculates at which questions respondents drop out.

rm.attrs()

Removes pattern and variable.labels from attributes list.

rm.pattern()

Removes pattern from attributes list.

lapply_names()

Applies function only to named elements of a list.

Using 'dplyr' verbs

mutate(<surveydata>) as_tibble(<surveydata>) as.tbl(<surveydata>) select(<surveydata>) arrange(<surveydata>) summarise(<surveydata>) summarize(<surveydata>) slice(<surveydata>)

Methods to support dplyr verbs.