summary.bins: Summarizing Binned Variable

summary.binsR Documentation

Summarizing Binned Variable

Description

summary method for "bins" and "optimal_bins".

Usage

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

## S3 method for class '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().

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.

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.

See Also

binning

Examples

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

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

# Print bins class object
bin

# Summarize bins class object
summary(bin)


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