db_compute_bins: Calculates a histogram bins

Description Usage Arguments See Also Examples

View source: R/histogram.R

Description

Uses very generic dplyr code to create histogram bins. Because of this approach, the calculations automatically run inside the database if 'data' has a database or sparklyr connection. The 'class()' of such tables in R are: tbl_sql, tbl_dbi, tbl_spark

Usage

1
db_compute_bins(data, x, bins = 30, binwidth = NULL)

Arguments

data

A table (tbl)

x

A continuous variable

bins

Number of bins. Defaults to 30.

binwidth

Single value that sets the side of the bins, it overrides bins

See Also

db_bin,

Examples

1
2
3
4
5
6
7
# Returns record count for 30 bins in mpg
mtcars %>%
  db_compute_bins(mpg)

# Returns record count for bins of size 10
mtcars %>%
  db_compute_bins(mpg, binwidth = 10)

edgararuiz/dbplot documentation built on Feb. 9, 2020, 10:21 p.m.