rect_bin: Bin data into rectangles (2d).

Description Usage Arguments Examples

Description

Bin data into rectangles (2d).

Usage

1
2
3
rect_bin(x, y, weight, xbreaks=interval_breaks(),
    ybreaks=interval_breaks(), na.rm=FALSE, xopen="right",
    yopen="right")

Arguments

x

a numeric vector of x positions

y

a numeric vector of y positions

weight

NULL or a numeric vector providing weights for each observation

xbreaks

a break function, or a vector of break points that should enclose all x values.

ybreaks

a break function, or a vector of break points that should enclose all y values.

xopen

are x intervals open on the "left" or "right".

yopen

are y intervals open on the "left" or "right".

na.rm

If TRUE missing values will be silently removed, otherwise they will be removed with a warning.

Examples

1
2
3
4
5
6
7
8
9
x <- rnorm(1e5)
y <- rnorm(1e5)
bins <- rect_bin(x, y)
plot(bins)

# Specifying bin widths
rect_bin(x, y, 
xbreaks = interval_breaks(binwidth = 0.5), 
ybreaks = interval_breaks(binwidth = 0.5))

hadley/densityvis documentation built on May 17, 2019, 9:56 a.m.