ez.factorder: change factor level order in a df

View source: R/frame.R

ez.factorderR Documentation

change factor level order in a df

Description

does not change factor label; only changes the order of printing out

Usage

ez.factorder(x, col, ord = NULL, print2scr = F)

Arguments

x

data frame or vector, factor or non-factor

col

a single column name, quoted string, ignored when x is not a data frame

ord

"az","za"–alphabetic;
"as"–as is, appearance;
c("small","medium","large")–specified level order
"col2" –another column in az (ignored if x is not a data frame)
"col2:az" –another column in az (ignored if x is not a data frame)
"col2:za" –another column in za (ignored if x is not a data frame)

Value

returns a new df, factor (non-factor->factor)

Note

if x df, pass (x,col,ord); if x not df, pass (x,ord), or (x,ord=)


jerryzhujian9/ezmisc documentation built on March 9, 2024, 12:44 a.m.