Learn R Programming

dlookr (version 0.5.0)

summary.bins: Summarizing Binned Variable

Description

summary method for "bins" and "optimal_bins".

Usage

# S3 method for bins
summary(object, ...)

# S3 method for bins print(x, ...)

Arguments

object

an object of "bins" and "optimal_bins", usually, a result of a call to binning().

...

further arguments passed to or from other methods.

x

an object of class "bins" and "optimal_bins", usually, a result of a call to binning().

Value

The function summary.bins() computes and returns a data.frame of summary statistics of the binned given in object. Variables of data frame is as follows.

  • levels : levels of factor.

  • freq : frequency of levels.

  • rate : relative frequency of levels. it is not percentage.

Details

print.bins() prints the information of "bins" and "optimal_bins" objects nicely. This includes frequency of bins, binned type, and number of bins. summary.bins() returns data.frame including frequency and relative frequency for each levels(bins).

See vignette("transformation") for an introduction to these concepts.

See Also

binning

Examples

Run this code
# NOT RUN {
# Generate data for the example
heartfailure2 <- heartfailure
heartfailure2[sample(seq(NROW(heartfailure2)), 20), "platelets"] <- NA

# Binning the carat variable. default type argument is "quantile"
bin <- binning(heartfailure2$platelets)

# Print bins class object
bin

# Summarize bins class object
summary(bin)

# }

Run the code above in your browser using DataLab