Learn R Programming

ggpmisc (version 0.2.8)

stat_debug_group: Diagnosis statistics on data grouping.

Description

stat_debug reports all distinct values in group and PANEL, and nrow, ncol and the names of the columns or variables, and the class of x and y for each group in a ggplot as passed to the compute_group function in the ggproto object.

Usage

stat_debug_group(mapping = NULL, data = NULL, geom = "null",
  summary.fun = dplyr::as_data_frame, summary.fun.args = list(),
  position = "identity", na.rm = FALSE, show.legend = FALSE,
  inherit.aes = TRUE, ...)

Arguments

mapping
The aesthetic mapping, usually constructed with aes or aes_string. Only needs to be set at the layer level if you are overriding the plot defa
data
A layer specific dataset - only needed if you want to override the plot defaults.
geom
The geometric object to use display the data
summary.fun
A function used to print the data object received as input.
summary.fun.args
A list.
position
The position adjustment to use for overlapping points on this layer
na.rm
a logical value indicating whether NA values should be stripped before the computation proceeds.
show.legend
logical. Should this layer be included in the legends? NA, the default, includes if any aesthetics are mapped. FALSE never includes, and TRUE always includes.
inherit.aes
If FALSE, overrides the default aesthetics, rather than combining with them. This is most useful for helper functions that define both data and aesthetics and shouldn't inherit behaviour from the default plot specification, e.g.
...
other arguments passed on to layer. This can include aesthetics whose values you want to set, not map. See layer for more details.

See Also

Other diagnosis.functions: stat_debug_panel

Examples

Run this code
library(ggplot2)
my.df <- data.frame(x = rep(1:10, 2),
                    y = rep(c(1,2), c(10,10)),
                    group = rep(c("A","B"), c(10,10)))
ggplot(my.df, aes(x,y)) + geom_point() + stat_debug_group()
ggplot(my.df, aes(x,y, colour = group)) + geom_point() + stat_debug_group()
ggplot(my.df, aes(x,y)) + geom_point() + facet_wrap(~group) + stat_debug_group()

Run the code above in your browser using DataLab