summary method for "bins" and "optimal_bins".
# S3 method for bins summary(object, ...) # S3 method for bins print(x, ...)
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(). |
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.
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.
# 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#> binned type: quantile #> number of bins: 10 #> x #> [25100,153000] (153000,196000] (196000,221000] (221000,236066.7] #> 30 27 30 25 #> (236066.7,259000] (259000,263957.2] (263957.2,283000] (283000,320600] #> 28 27 29 27 #> (320600,376200] (376200,850000] <NA> #> 28 28 20#> levels freq rate #> 1 [25100,153000] 30 0.10033445 #> 2 (153000,196000] 27 0.09030100 #> 3 (196000,221000] 30 0.10033445 #> 4 (221000,236066.7] 25 0.08361204 #> 5 (236066.7,259000] 28 0.09364548 #> 6 (259000,263957.2] 27 0.09030100 #> 7 (263957.2,283000] 29 0.09698997 #> 8 (283000,320600] 27 0.09030100 #> 9 (320600,376200] 28 0.09364548 #> 10 (376200,850000] 28 0.09364548 #> 11 <NA> 20 0.06688963