order_by_freq | R Documentation |
Order a factor using the frequency of levels
order_by_freq(x, order = is.ordered(x))
x |
a vector: numerical, character, factor, etc. |
a factor with levels ordered by frequency (largest first)
zf <- letters[c(1,1,2,2,2,3,2,4,5,6)] zf table(zf) zo <- order_by_freq(zf) zo table(zo) attributes(zo)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.