Description Usage Arguments Value
Get U-dummy matrix for one-dimensional vector
1 2 | getUDummyMatForOneVec(x_vec, levels = NULL, drop_last = TRUE,
only_info = FALSE)
|
x_vec |
A non-numeric vector to be converted into dummy matrix. |
levels |
A character vector indicates unique set of possible values.
If NULL, all the unique values of |
drop_last |
A boolean value. If TRUE, the last column of dummy matrix is dropped to avoid colinear |
only_info |
A bboolean value. If TRUE, actual creation of dummy matrix is omitted. |
a list with two members levels and dummy_mat.
levels: Same as input
drop_last: Same as input
dummy_mat: An integer matrix with size (length of x_vec, length of levels or minus 1 when drop_last=TRUE).
dummy_mat[i, j] is 1 if and only if x_vec[i] == levels[j], and 0 otherwise.
Omitted if only_info=TRUE
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.