reorderFactor: Reorder a factor in a dataframe

Description Usage Arguments Details Value Examples

View source: R/reshape_data.R

Description

reorderFactor returns dataframe with reordered factor

Usage

1

Arguments

df

dataframe

var

variable (factor) to reorder; options are: 'hour'

order

list of factor levels in desired order

Details

This fucntion reorders the levels of factor var. This is useful, for example, for changing the facet order in ggplot2 graphics.

Value

dataframe with reordered factor levels for var

Examples

1
2
3
data(wind)
order <- c(11, 16, 0, 1:10, 12:15, 17:23)
s <- reorderFactor(wind, hour, order)

nwagenbrenner/windtools documentation built on July 27, 2018, 12:04 p.m.