Learn R Programming

dlookr (version 0.5.0)

extract: Extract bins from "bins"

Description

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

Usage

extract(x)

# S3 method for bins extract(x)

Arguments

x

a bins class or optimal_bins class.

Value

factor.

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.

See Also

binning, binning_by.

Examples

Run this code
# NOT RUN {
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)

# }

Run the code above in your browser using DataLab