Description Usage Arguments Value
Get O-dummy matrix for one-dimensional vector
1 2 | getODummyMatForOneVec(x_vec, breaks = NULL, nbin.max = 100,
only_info = FALSE, dummy_type = NULL)
|
x_vec |
An integer or numeric vector to be converted into dummy matrix. |
breaks |
A numeric vector which indicates the boundaries of bins, of length (number of bins + 1). If NULL, evenly cut bins are automatically generated and used. |
nbin.max |
A maximum number of bins which is used. Only used when |
only_info |
A boolean value. If TRUE, actual creation of dummy matrix is omitted. |
dummy_type |
A character value. Choose 'C'(default) or 'J'. For integer or numeric
|
a list with two members breaks
and dummy_mat
.
breaks
: Same as input
dummy_mat
: An integer matrix with size (length of x_vec
, length of breaks
minus 1).
dummy_mat[i, j]
is 1 if and only if breaks[i] < x_vec[i] <= breaks[i+1]
, and 0 otherwise.
Note that, in case where x_vec[i]
is outside of (breaks[1], breaks[length(breaks)]]
,
x_vec[i]
is considered to be in the first bin if x_vec[i] <= breaks[1]
, and
be in the last bin if x_vec[i] > breaks[length(breaks)]
.
Omitted if only_info=TRUE
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.