bin: Create a binned variable.

Description Usage Arguments Details Examples

View source: R/bin.r

Description

Create a binned variable.

Usage

1
bin(x, width = find_width(x), origin = find_origin(x, width), name = NULL)

Arguments

x

numeric or integer vector

width

bin width. If not specified, about 10,000 bins will be chosen using the algorithim in find_width.

origin

origin. If not specified, guessed by find_origin.

name

name of original variable. This will be guessed from the input to group if not supplied. Used in the output of condense etc.

Details

This function produces an R reference class that wraps around a C++ function. Generally, you should just treat this as an opaque object with reference semantics, and you shouldn't call the methods on it - pass it to condense and friends.

Examples

1
2
3
4
x <- runif(1e6)
bin(x)
bin(x, 0.01)
bin(x, 0.01, origin = 0.5)

hadley/bigvis documentation built on May 17, 2019, 9:45 a.m.