Description Usage Arguments Value Examples
View source: R/feature_creation.R
This function creates particular bins of equal intervals based on the specified numeric column of a data frame.
1 | binning(input, target, interval)
|
input |
an object of type data.frame. Preferably the output of reshapeData(). |
target |
a mandatory character string defining the variable that is to be used for binning. |
interval |
a mandatory non-negative numeric value indicating the amount of bins. |
An object of type data.frame in the same form as data including additional binned column.
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=4),
'type'=rep(c('Var1', "Var2"), times=10),
'value'=rep(c(1:5), times=4),
'date'=rep(seq(as.Date("2000/1/1"), by = "day", length.out=10), each=2))
# create rectangle version of user journey
dat = reshapeData(data)
# use function to perform binning on a chosen variable
dat_bin = binning(dat, target='Var1', interval=2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.