conversion: Conversion between Representations of Responses or States

conversionR Documentation

Conversion between Representations of Responses or States

Description

Converts between binary matrix and pattern representations of response patterns or knowledge states.

Usage

as.pattern(R, freq = FALSE, as.letters = FALSE, as.set = FALSE)

as.binmat(N.R, uniq = TRUE, col.names = NULL, as.logical = FALSE)

Arguments

R

an indicator matrix of response patterns or knowledge states.

N.R

either a (named) vector of absolute frequencies of response patterns; or a character vector of response patterns or knowledge states; or a set of sets representing the knowledge structure.

freq

logical, should the frequencies of response patterns be reported?

uniq

logical, if TRUE, only the unique response patterns are returned.

as.letters

logical, return response patterns as combinations of letters.

as.set

logical, return response patterns as set of sets.

col.names

column names for the state or response matrix.

as.logical

logical, return logical matrix of states.

Value

as.pattern returns a vector of integers named by the response patterns if freq is TRUE, else a character vector. If as.set is TRUE, the return value is of class set.

as.binmat returns an indicator matrix. If as.logical is TRUE, it returns a logical matrix.

See Also

blim, set in package sets.

Examples

data(DoignonFalmagne7)
as.pattern(DoignonFalmagne7$K)
as.pattern(DoignonFalmagne7$K, freq = TRUE)
as.pattern(DoignonFalmagne7$K, as.letters = TRUE)
as.pattern(DoignonFalmagne7$K, as.set = TRUE)

dim(as.binmat(DoignonFalmagne7$N.R))
dim(as.binmat(DoignonFalmagne7$N.R, uniq = FALSE))

## Knowledge structure as binary matrix
as.binmat(c("000", "100", "101", "111"))
as.binmat(set(set(), set("a"), set("a", "c"), set("a", "b", "c")))
as.binmat(c("000", "100", "101", "111"), as.logical = TRUE)

pks documentation built on May 5, 2023, 3:08 p.m.

Related to conversion in pks...