code.topk {cata} | R 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 |
one.above |
default is |
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. 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)
[Package cata version 0.1.0.6 Index]