binned_data_cutpoints: Get the unique cutpoints of each appropriate column in a tbl.

Description Usage Arguments Details Value See Also Examples

Description

This function takes a dataframe where any number of columns have been binned into factors using cut/vector_bin and returns a named list containing the cutpoints for each variable. This is useful for, for example, binning a new dataset into the same bins as an older dataset- such as when making predictions on test data

Usage

1

Arguments

d

a tbl

parallel

logical. If TRUE, parallel foreach used. Must register parallel beforehand. Default false

Details

This function essentially calls get_vector_cutpoints on all factor type columns of d. It is meant to be used to provide an output format that works with the bins argument of simple_bin, for the purpose of defining cutpoints based on one dataset and then applying them to other datasets. The basic functionality of binning on training data and applying those bins to test data is built right in to simple_bin, but this function allows the user total flexibility.

Value

a named list containing one vector for each factor type variable. Each vector contains the unique cut points of that variable

See Also

get_vector_cutpoints, simple_bin

Other discretization: get_vector_cutpoints, simple_bin, vector_bin

Examples

1
2
3
4
x <- dplyr::data_frame(v1 = cut(rnorm(100),c(-1,0,1)),
                       v2 = cut(rnorm(100),c(-.5,0,.5)))
binned_data_cutpoints(x)
binned_data_cutpoints(x,parallel = TRUE)

awstringer/modellingTools documentation built on May 11, 2019, 4:11 p.m.