View source: R/feature-utils.R
factor_to_matrix | R Documentation |
범주(factor)형 벡터를 범주 수만큼의 열을 지닌 행렬로 변환한다.
factor_to_matrix(x, .reflevel = NULL)
x |
범주형 벡터. |
.reflevel |
기준 범주값. NULL일 때는 one-hot encoding. NULL이 아닌 값일 때는 해당 범주는 모든 열에 대해 0의 값을 가지도록 dummy variable encoding. |
행렬.
x <- factor(c(1L, 2L, 3L, 1L), levels = c(1L, 2L, 3L)) factor_to_matrix(x) factor_to_matrix(x, .reflevel = 3L)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.