Learn R Programming

expss (version 0.11.6)

mrset: Create multiple response set/multiple dichotomy set from variables

Description

These functions are intended for usage with tables - tables, cross_cpct, cross_fun. Result of mrset is considered as muliple-response set with category encoding and result of mdset is considered as multiple response set with dichotomy (dummy) encoding e. g. with 0 or 1 in the each column. Each column in the dichotomy is indicator of absence or presence of particular feature. Both functions don't convert its arguments to anything - it is supposed that arguments already have appropriate encoding. For conversation see as.dichotomy or as.category.

  • mrset_f and mdset_f select variables by fixed pattern. Fixed pattern can be unquoted. For details see ..f.

  • mrset_p and mdset_p select variables for multiple-responses by perl-style regular expresssion. For details see ..p.

  • mrset_t and mdset_t select variables by expanding text arguments. For details see ..t and text_expand.

Usage

mrset(..., label = NULL)

mdset(..., label = NULL)

mrset_f(..., label = NULL)

mdset_f(..., label = NULL)

mrset_p(..., label = NULL)

mdset_p(..., label = NULL)

mrset_t(..., label = NULL)

mdset_t(..., label = NULL)

Value

data.frame of class category/dichotomy

Arguments

...

variables

label

character optional label for multiple response set

See Also

as.dichotomy, as.category

Examples

Run this code
data.table::setDTthreads(2)
data(product_test)

cross_cpct(product_test, mrset(a1_1 %to% a1_6))

# same result
cross_cpct(product_test, mrset_f(a1_))

# same result
cross_cpct(product_test, mrset_p("a1_"))

# same result
cross_cpct(product_test, mrset_t("a1_{1:6}"))

Run the code above in your browser using DataLab