ordered_factor: Creates an ordered factor based on order of another variable

Description Usage Arguments Details Value Examples

View source: R/ordered_factor.R

Description

Creates an ordered factor based on order of another variable

Usage

1

Arguments

var

variable to be converted into a factor

seq

variable that implies the sequence of var when the function order is applied to it

Details

This function helps to re-order groups in a ggplot2 plot. See example below.

Value

factor(var) with the implied order by seq.

Examples

1
2
3
4
val <- rpois(10,100)
num <- sample(seq(1,10))
	
levels(ordered_factor(val, num))

sumtxt/datatools documentation built on Jan. 3, 2021, 1:39 a.m.