Learn R Programming

cata (version 0.1.0.27)

toMatrix: Converts 3d array of CATA data to a tall 2d matrix format

Description

Converts a three-dimensional array (\(I\) assessors, \(J\) products, \(M\) attributes) to a two-dimensional matrix with (\(I\) assessors, \(J\) products) rows and (\(M\) attributes) columns, optionally preceded by two columns of row headers.

Usage

toMatrix(X, header.rows = TRUE, oneI = FALSE, oneM = FALSE)

Value

A matrix with \(I\) assessors \(\times J\) products in rows and \(M\) attributes in columns (preceded by 2 columns) of headers if header.rows = TRUE

Arguments

X

three-dimensional array (\(I\) assessors, \(J\) products, \(M\) attributes) where values are 0 (not checked) or 1 (checked)

header.rows

TRUE (default) includes row headers; set to FALSE to exclude these headers

oneI

indicates whether calculation is for one assessor (default: FALSE)

oneM

indicates whether calculation is for one attribute (default: FALSE)

Examples

Run this code
data(bread)

# convert CATA results from the first 8 consumers and the first 4 attributes
# to a tall matrix
toMatrix(bread$cata[1:8,,1:4])

Run the code above in your browser using DataLab