The ggstats package provides new statistics, new geometries and new
positions for ggplot2 and a suite of functions to facilitate the
creation of statistical plots.
library(ggplot2)
ggplot(as.data.frame(Titanic)) +
aes(x = Class, fill = Survived, weight = Freq, by = Class) +
geom_bar(position = "fill") +
geom_text(stat = "prop", position = position_fill(.5)) +
facet_grid(~Sex)
Compute weighted mean
data(tips, package = "reshape")
ggplot(tips) +
aes(x = day, y = total_bill, fill = sex) +
stat_weighted_mean(geom = "bar", position = "dodge") +
ylab("Mean total bill per day and sex")
ggstats: extension toggplot2for plotting statsThe
ggstatspackage provides new statistics, new geometries and new positions forggplot2and a suite of functions to facilitate the creation of statistical plots.Installation & Documentation
To install stable version:
Documentation of stable version: https://larmarange.github.io/ggstats/
To install development version:
Documentation of development version: https://larmarange.github.io/ggstats/dev/
Plot model coefficients
Comparing several models
Compute custom proportions
Compute weighted mean
Compute cross-tabulation statistics
Plot survey objects taking into account weights
Plot Likert-type items
Connect bars
Generate a cascade plot