extract.bins: Extract bins from "bins"

extractR Documentation

Extract bins from "bins"

Description

The extract() extract binned variable from "bins", "optimal_bins" class object.

Usage

extract(x)

## S3 method for class 'bins'
extract(x)

Arguments

x

a bins class or optimal_bins class.

Details

The "bins" and "optimal_bins" class objects use the summary() and plot() functions to diagnose the performance of binned results. This function is used to extract the binned result if you are satisfied with the result.

Value

factor.

See Also

binning, binning_by.

Examples

library(dplyr)

# Generate data for the example
heartfailure2 <- heartfailure
heartfailure2[sample(seq(NROW(heartfailure2)), 5), "creatinine"] <- NA

# optimal binning using binning_by()
bin <- binning_by(heartfailure2, "death_event", "creatinine")
bin

# extract binning result
extract(bin) %>% 
  head(20)


dlookr documentation built on July 9, 2023, 6:31 p.m.