add_mm: Add measurement model to a survey

Description Usage Arguments Structure/naming convention for mm Note Author(s) Examples

Description

Second step in creating a survey that can be used with generate_report. The function accepts a data.frame as input, but columns must be correctly named or be dropped (see description below). If no model is provided (mm = NULL), add_mm will generate a suggestion based on the data.

Usage

1
2
3
4
5
6
add_mm(srv, mm = NULL)

get_question(srv, vars)

## S3 method for class 'survey_mm'
print(mm, width = getOption("width"))

Arguments

srv

A survey object.

mm

Optional: Specify a data.frame which contains the measurement model.

Structure/naming convention for mm

latent

A column describing special significance of variables, such as latent association, complaints and so forth.

manifest

The name of variables/columns in the data.

question

Questions as posed during interviews. Used for printed values in generate_report.

type

The type of variable in the data. Either character, factor, numeric, or scale. If type is specified as factor, the values (see below) will be used to create ordered factors.

values

Optional: Possible values (factor levels) for variables in the data. If type is scale, values are the outer points (1 and 10), and an optional "do not know".

A structure and naming convention is also required for the survey itself, see help(survey) for information.

Note

For smaller surveys, using this function without specifiying a model might not show all possible values for factor variables etc.

Author(s)

Kristian D. Olsen

Examples

1
2
x <- survey(data.frame("test" = 1, stringsAsFactors = FALSE))
x %>% add_mm()

itsdalmo/reporttool documentation built on May 18, 2019, 7:11 a.m.