splitlevel: Split a factor level based on another factor

Description Usage Arguments Value Examples

Description

Split a factor level based on another factor in a data.frame. If you want to split a factor level based on a numerical variable, first create a new factor level corresponding to the conditioning of your numerical variable, then use 'splitlevel' to create a factor with the split level.Look at the examples in the vignette for usage.

Usage

1
2
splitlevel(data, splitfactor, splitlev, factorby,
  newfactorname = "splitfactor")

Arguments

data

Input data-frame

splitfactor

Factor to be split

splitlev

The level in this factor to be split

factorby

The factor on which to split based on

newfactorname

The name of the new split factor level

Value

data.frame

Examples

1
2
x <- data.frame(first = c(1:20), second = rep(c("A","B"), each = 10), third = rep_len(c("W","X","Y","Z"), 20))
splitlevel(x,"second","A","third", "callitwhatyouwant")

KPdir/foofactors documentation built on May 8, 2019, 4:41 p.m.