createInteractionTerms: Create Interaction Terms

Description Usage Arguments Value Examples

View source: R/feature_creation.R

Description

This function creates interaction terms between numeric columns. Essentially, it multiplies each column with one another and adds these to the input data.

Usage

1
createInteractionTerms(input, target, no.use, na.rm)

Arguments

input

an object of type data.frame. Preferably the output of reshapeData().

target

a mandatory character string defining the variable that is to be analyzed eventually and therefore not included in the computation.

no.use

an optional character string that defines other variables that should not be used.

na.rm

optional logical value True or False. If True, all rows with missing values are omitted. Default is False.

Value

An object of type data.frame in the same form as data including the additonally created columns.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# create data frame with mandatory columns
data = data.frame('id'=rep(c(1:5), each=6),
      'type'=rep(c('Var1', 'Var2', 'Var3'), times=10),
      'value'=rep(c(1:5), times=6),
      'date'=rep(seq(as.Date("2000/1/1"), by = "day", length.out=15), each=2))

# create rectangle version of user journey
dat = reshapeData(data)

# use function to create interaction terms and exclude the variable 'mood' from the computation
datInteract = createInteractionTerms(dat, target='mood', no.use=F)

LoneWolf6/UJ-Analysis documentation built on Sept. 16, 2020, 4:59 a.m.