Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

auto_bin

Calculate appropriate bin separators for vpc


Description

This function calculates bin separators either using R's native binning approaches available in the classInt library such as 'kmeans', 'jenks', 'pretty' etc. Alternatively, a custom approach is available which is based on finding the nadirs in the density functions for the independent variable. Default approach is k-means clustering.

Usage

auto_bin(dat, type = "kmeans", n_bins = 8, verbose = FALSE, ...)

## S3 method for class 'numeric'
auto_bin(dat, type = "kmeans", n_bins = 8, verbose = FALSE, ...)

## S3 method for class 'data.frame'
auto_bin(dat, type = "kmeans", n_bins = 8, verbose = FALSE, ...)

Arguments

dat

data frame

type

auto-binning type: "density", "time", or "data"

n_bins

number of bins to use; either a positive integer or "auto". For "density" the function might not return a solution with the exact number of bins.

verbose

show warnings and other messages (TRUE or FALSE)

...

arguments passed on to underlying binning functions

Value

A vector of bin separators


vpc

Create Visual Predictive Checks

v1.2.2
MIT + file LICENSE
Authors
Ron Keizer <ronkeizer@gmail.com>
Initial release
2021-01-11

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.