reorderFactor.by: Reorder factors according to simple funciton

Description Usage Arguments Value

Description

Will reorder factors based off of a group subset

Usage

1
2
reorderFactor.by(data, factor.to.order, factor.col, by.factor, FUN = NULL,
  applied.on, group.by = NULL, decreasing = FALSE)

Arguments

data

data frame

factor.to.order

column name or index of factors that will be reordered

factor.col

column name or index that contains 'by.factor'

by.factor

character name of factor in factor.col that data will be subsetted for calculations and group desired for order

FUN

Simple function that takes a vector of numbers and returns a single output. Default set to NULL, must assign a function if group.by is not NULL.

applied.on

Numeric vector used as inputs to FUN. Will ultamitly determine order of factor.to.order

group.by

column names or indexes that further groups by.factor subset to which FUN is applied. Default set to NULL.

decreasing

logical, default set to FALSE. Determines if order is increasing or decreasing.

Value

returns data with factor.to.order reordered by FUN of by.factor subsetted through group.by.


jtlandis/justinmisc documentation built on May 25, 2019, 8:18 a.m.