indarr: Create Array of Indicator Matrices

Description Usage Arguments Value Author(s) Examples

View source: R/indarr.R

Description

This function takes a matrix or data.frame and the number of rating categories maxcat and produces a three-way array of m by maxcat indicator matrices, one for each of the n rows. The input x must be a matrix or data.frame of dimensions n by m which contains the ratings on a scale of 1 to maxcat for m items. Note that missing values (NA's) will not appear in the columns.

Usage

1
indarr(x, maxcat, na.add = TRUE)

Arguments

x

a matrix of data.frame

maxcat

an integer indicating the maximum of the rating scale (which is assumed to start with 1)

na.add

logical indicating whether to add a designated category for missings or not. Defaults to TRUE.

Value

A list of rating by item indicator matrices.

Author(s)

Pieter C. Schoonees

Examples

1
2
3
data("lov")
arr <- indarr(lov[1:10, 1:9], maxcat = 9)
str(arr)

lsbclust documentation built on April 20, 2018, 1:03 a.m.