Create a stacked bar chart of digit distribution, with a grouping variable on the x axis, and the distribution of digits in a particular digit place on the y axis.
Usage
plotPlaceDigits(
dfData,
colData,
colGroup,
power_10,
strGroupLabel = colGroup,
strPlaceLabel = powerToOrdinal(power_10, strAfter = "Place"),
strChartTitle =
glue::glue("Digit Distribution for {strPlaceLabel} of Data by {strGroupLabel}"),
scaleDigitPalette = ggplot2::scale_fill_brewer(palette = "Set3"),
themePlot = ggplot2::theme_bw()
)
Arguments
- dfData
data.frame
A data.frame with a grouping column and at least one numeric data column.- colData
character
The name of a column that contains numeric data.- colGroup
character
The name of a column to group by.- power_10
integer
The 10s place to check, as a power of 10.- strGroupLabel
character
An optional name to use for the grouping column in labels.- strPlaceLabel
character
An optional name to use for the place column in labels.- strChartTitle
character
An optional title for the chart.- scaleDigitPalette
An optional
ggplot2::scale_fill_discrete()
palette to use for the digits.- themePlot
An optional
ggplot2::theme()
to apply to the plot.