countPlot

Edit pageLast modified: 15 July 2024

The countPlot adds a count-plot layer function optionally creates a new context with bars aesthetics and new dataset which contains the "count" statistic calculated on sample of a single categorical variable x. In this context, all required aesthetics are assigned by default but can be overridden.

It's a bar plot where each bar is representing one of the categories: its x coordinate is corresponding to the category and y to its count. It's weighted, it means the weighted count for each category is calculated (each element within a category is counted along with its weight).