MergeLevelsCausataData: Combines least-frequently occurring levels of a factor into...

Description Usage Arguments Value Author(s) See Also Examples

Description

MergeLevels is applied to a CausataData object, and the merge process is recorded so that it can be repeated during scoring.

Usage

1
2
3
## S3 method for class 'CausataData'
MergeLevels(this, variableName=NULL, max.levels, 
  other.name="Other", verbose=FALSE, ...)

Arguments

this

An object from CausataData.

variableName

If a name is supplied then the variable matching the name will have MergeLevels applied. If no name is provided then MergeLevels is applied to every factor in causataData.

max.levels

See MergeLevels.

other.name

See MergeLevels.

verbose

If TRUE then summary information will be printed to the screen.

...

Unused extra arguments.

Value

Returns an object of class CausataData.

Author(s)

Justin Hemann <support@causata.com>

See Also

CausataData, MergeLevels.

Examples

1
2
3
4
5
6
7
8
library(stringr)
df <- data.frame(
  f1__AP=factor(str_split("a a a b b b c c c d e f g h", " ")[[1]]), 
  f2__AP=factor(c(rep("x",7),rep("y",7))))
causataData <- CausataData(df, rep(0,nrow(df)))
# For the factor f1__AP, the levels d,e,f,g are merged into Other.
# f2__AP is not altered since it has only two levels.
causataData <- MergeLevels(causataData, max.levels=4) 

Causata documentation built on May 2, 2019, 3:26 a.m.