orderedFactor: Preserve factor order

Description Usage Arguments Value Examples

Description

orderedFactor() is a convenience wrapper for factor() that orders the levels as they appear in the data if the levels argument is not specified. This is valuable for making plots with ggplot2, where the axis labels are usually arranged in alphabetical order rather than the order in which they appear.

Usage

1

Arguments

x

A vector of data, usually taking a small number of distinct values.

...

Other arguments passed on to base::factor().

Value

A factor.

Examples

1
2
orderedFactor(3:1)
orderedFactor(9:12, exclude=11)

anilchalisey/juggleR documentation built on May 9, 2019, 4 a.m.