FactorToNumeric | R Documentation |
Convert a factor variable to a numeric vector (when the factor is ordered), or a matrix of indicator variables (when the factor is not ordered).
FactorToNumeric(x, binary = TRUE, name = NULL, remove.first = TRUE)
x |
A factor or ordered factor. |
binary |
Returns the factor as binary variables. If |
name |
The name of the variable. |
remove.first |
Remove the first binary variable, if a binary variable is being created. |
a vector of length x
, if x
is an ordered factor; otherwise, a 0-1 matrix
with number of rows equal to the length of x
an number of columns equal to the number of
levels in x
model.matrix
, AsNumeric
, OrderedToNumeric
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.