create.histogram: Create histogram.

Description Usage Arguments Author(s) Examples

View source: R/create.histogram.R

Description

Create a histogram using the ggplot2 framework.

Usage

1
create.histogram(data = NULL, x = NULL, xlab = NULL, ylab = NULL, binwidth = NULL, group = NULL, group.col = FALSE, group.row = FALSE, filename = NULL, resolution = 1200, width = 8, height = 8, theme = NULL)

Arguments

data

data frame containing the data

x

data frame column name to use in histogram, must be passed as a string

xlab

label for the x-axis

ylab

label for the y-axis

binwidth

unit width for binning

group

Dataframe element to use to group bars using facet_grid()

group.col

Boolean to group data for facet_grid() by column

group.row

Boolean to group data for facet_grid() by row

filename

filename to save plot to, if none is provided, plot goes to STDOUT

resolution

the resolution of the plot to be passed to write.plot

width

plot width

height

plot height

theme

a ggplot2 theme

Author(s)

Richard de Borja <richard.deborja@sickkids.ca>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
# create a simple histogram
create.histogram(
  data = mtcars,
  x = 'hp',
  binwidth = 50
  )
  
# add custom X and Y axis labels
create.histogram(
  data = mtcars,
  x = 'gear',
  binwidth = 1,
  xlab = 'Number of Gears',
  ylab = 'Frequency'
  )

rdeborja/plotting.general documentation built on May 27, 2019, 3:05 a.m.