dbplot_histogram: Histogram

Description Usage Arguments See Also Examples

View source: R/histogram.R

Description

Uses very generic dplyr code to aggregate data and then 'ggplot2' to create the histogram. 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
dbplot_histogram(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

dbplot_bar, dbplot_line , dbplot_raster

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
library(ggplot2)
library(dplyr)

# A ggplot histogram with 30 bins
mtcars %>%
  dbplot_histogram(mpg)

# A ggplot histogram with bins of size 10
mtcars %>%
  dbplot_histogram(mpg, binwidth = 10)

dbplot documentation built on Feb. 7, 2020, 9:06 a.m.