code.topk: Apply top-k box coding to scale data

View source: R/cata.R

code.topkR Documentation

Apply top-k box coding to scale data

Description

Apply top-k box coding to scale data. Using defaults give top-2 box (T2B) coding.

Usage

code.topk(X, zero.below = 8, one.above = 7)

Arguments

X

input matrix

zero.below

default is 8; values below this numeric threshold will be coded 0; use NULL if there is no such threshold

one.above

default is 7; values above this numeric threshold will be coded 1; use NULL if there is no such threshold

Value

matrix X with top-k coding applied

References

Castura, J.C., Meyners, M., Pohjanheimo, T., Varela, P., & Næs, T. (2023). An approach for clustering consumers by their top-box and top-choice responses. Journal of Sensory Studies, e12860. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1111/joss.12860")}

Examples

# Generate some data
set.seed(123)
X <- matrix(sample(1:9, 100, replace = TRUE), nrow = 5)

# apply top-2 box (T2B) coding
code.topk(X, zero.below = 8, one.above = 7)

cata documentation built on Oct. 8, 2024, 9:07 a.m.

Related to code.topk in cata...