iNZightMR {iNZightMR}R Documentation

Create iNZightMR multiple response object (MRO)

Description

Creates a multiple response object (MRO) containing binary response matrix (zeros and ones) as well as the input data source.

Usage

iNZightMR(frm, data, Labels = NULL, inverse = FALSE, ...)

Arguments

frm

formula containing the response variables

data

a data.frame containing response and explanatory variables

Labels

labels for the response categories; by default, the function will attempt to. Can also be the function substrsplit, which will detect a common base in the variables (see Details)

inverse

if TRUE, binary responses will be reversed (see details)

...

additional arguments, passed to model.frame

Details

The individual response variable names can be detected from the variable name by passing Labels = substrsplit. For example, in 'ethniceng' and 'ethnicmri', 'ethnic' is common to both, so the labels will be 'eng' and 'mri'.

If a user wants to inverse the response (zeros becomes ones), then pass inverse = TRUE. This is useful when the responses are characters (such as "correct" and "wrong", where correct would be given a zero) and the order needs reversing (so that correct is 1 instead).

Value

An mro object containing a multiple response binary matrix and input data source

See Also

barplotMR, mroPara

Examples

mr <- iNZightMR(online ~ onlinegame + onlinevideo + onlinemusic,
    data = census.at.school.5000)

# users can also override the variable names
iNZightMR(online ~ onlinegame + onlinevideo + onlinemusic,
    Labels = c("gaming", "youtube", "spotify"),
    data = census.at.school.5000
)

[Package iNZightMR version 2.3.0 Index]