PrettyHistogram: Generate a subjectively pretty ggplot histogram

Description Usage Arguments Value See Also Examples

View source: R/pretty_histogram.r

Description

Uses a set of defaults that I like to generate a histogram of either a numeric or factor

Usage

1
PrettyHistogram(v, force.factor = FALSE, sort.factor = TRUE, ...)

Arguments

v

array with data that goes into histogram

force.factor

logical, convert input to factor so you ensure a percentage for each level

sort.factor

should factor be reordered so it goes from most to least common?

...

any additional argument passed on to ggplot2::labs such as title, xlab, ylab.

Value

ggplot object

See Also

ggplot2::geom_histogram which this function wraps

Examples

1
2
PrettyHistogram(iris$Sepal.Length)
PrettyHistogram(iris$Species)

petersmittenaar/peterr documentation built on Feb. 13, 2021, 9:20 p.m.