| fctr | R Documentation |
Creates a factor.
By default, the output will have its levels in the original order, i.e., levels = unique(x), as opposed to factor's default where levels = sort(unique(x)).
fctr(x, levels=unique(x), ..., sort=FALSE, rev=FALSE)
x |
Object to be turned into a factor. |
levels |
Levels for the new factor; |
... |
Other arguments passed to |
sort |
Logical, default |
rev |
Logical, default |
Factor vector having levels ordered according to the order of elements in input and arguments sort, rev.
levels(factor(c("b","a","c")))
levels(fctr(c("b","a","c")))
levels(fctr(c("b","a","c"), rev=TRUE))
levels(fctr(c("b","a","c"), sort=TRUE))
levels(fctr(c("b","a","c"), sort=TRUE, rev=TRUE))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.