fn_target: Redefines target value

Description Usage Arguments Value Author(s) Examples

View source: R/functions.R

Description

The function redefines the "binary" target variable to be used for modelling. It takes the variable or field name of the target and the event class. It changes the target field name to "Target", changes the events into 1 and non-events as 0 and places the target column at the end of the dataframe before returning it as output.

Usage

1
fn_target(base, target, event)

Arguments

base

input dataframe

target

column / field name for the target variable, to be passed as string

event

the event class, to be passed as string

Value

The function returns a dataframe after changing the target classes to 0 or 1.

Author(s)

Arya Poddar <aryapoddar290990@gmail.com>

Examples

1
2
3
4
5
data <- iris
data$Species <- as.character(data$Species)
data$Y <- sample(0:1,size=nrow(data),replace=TRUE)

data2 <- fn_target(base = data,target = "Y",event = 1)

Example output



scorecardModelUtils documentation built on May 2, 2019, 9:59 a.m.