type.enum | R Documentation |
Define a conformance rule to match a factor with specific levels.
type.enum(..., .drop = FALSE, .ordered = FALSE)
... |
the levels (no quotes, backticks if required) |
.drop |
should levels present in the data and not specified cause an error (FALSE the default) or be silently dropped to NA values (TRUE). |
.ordered |
must the factor be ordered |
a function that can check and convert input into the factor with specified levels. This will re-level factors with matching levels but in a different order.
f = type.enum(one,two,three)
f(c("three","two","one"))
f(factor(rep(1:3,5), labels = c("one","two","three")))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.