{"id":33187114,"url":"https://larmarange.github.io/ggstats/","last_synced_at":"2025-11-25T18:00:39.256Z","repository":{"id":61034310,"uuid":"547360047","full_name":"larmarange/ggstats","owner":"larmarange","description":"Extension to ggplot2 for plotting stats","archived":false,"fork":false,"pushed_at":"2025-09-12T15:48:54.000Z","size":60816,"stargazers_count":44,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-12T17:59:39.588Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://larmarange.github.io/ggstats/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/larmarange.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-10-07T14:53:52.000Z","updated_at":"2025-09-12T15:39:46.000Z","dependencies_parsed_at":"2023-02-09T11:31:26.097Z","dependency_job_id":"28c886f9-3940-4481-b1ef-be0ced943b0e","html_url":"https://github.com/larmarange/ggstats","commit_stats":{"total_commits":367,"total_committers":2,"mean_commits":183.5,"dds":0.02452316076294281,"last_synced_commit":"2dcf6ca1e88f4c5a10e544ab5d6fdd0ec62d790d"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/larmarange/ggstats","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/larmarange%2Fggstats","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/larmarange%2Fggstats/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/larmarange%2Fggstats/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/larmarange%2Fggstats/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/larmarange","download_url":"https://codeload.github.com/larmarange/ggstats/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/larmarange%2Fggstats/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286079811,"owners_count":27282121,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-11-25T02:00:05.816Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-11-16T05:00:30.372Z","updated_at":"2025-11-25T18:00:39.248Z","avatar_url":"https://github.com/larmarange.png","language":"R","funding_links":[],"categories":["Data and models"],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\",\n  out.width = \"100%\"\n)\n```\n\n# `ggstats`: extension to `ggplot2` for plotting stats\n\n\u003c!-- badges: start --\u003e\n[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable)\n[![R-CMD-check](https://github.com/larmarange/ggstats/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/larmarange/ggstats/actions/workflows/R-CMD-check.yaml)\n[![Codecov test coverage](https://codecov.io/gh/larmarange/ggstats/graph/badge.svg)](https://app.codecov.io/gh/larmarange/ggstats)\n[![CRAN status](https://www.r-pkg.org/badges/version/ggstats)](https://CRAN.R-project.org/package=ggstats)\n[![DOI](https://zenodo.org/badge/547360047.svg)](https://zenodo.org/badge/latestdoi/547360047)\n\u003c!-- badges: end --\u003e\n\nThe `ggstats` package provides new statistics, new geometries and new positions for `ggplot2` and a suite of functions to facilitate the creation of statistical plots.\n\n## Installation \u0026 Documentation\n\nTo install **stable version**:\n\n```{r eval=FALSE}\ninstall.packages(\"ggstats\")\n```\n\nDocumentation of stable version: \u003chttps://larmarange.github.io/ggstats/\u003e\n\nTo install **development version**:\n\n```{r eval=FALSE}\nremotes::install_github(\"larmarange/ggstats\")\n```\n\nDocumentation of development version: \u003chttps://larmarange.github.io/ggstats/dev/\u003e\n\n## Plot model coefficients\n\n\n```{r}\nlibrary(ggstats)\n\nmod1 \u003c- lm(Fertility ~ ., data = swiss)\nggcoef_model(mod1)\nggcoef_table(mod1)\n```\n\n## Comparing several models\n\n```{r}\nmod2 \u003c- step(mod1, trace = 0)\nmod3 \u003c- lm(Fertility ~ Agriculture + Education * Catholic, data = swiss)\nmodels \u003c- list(\n  \"Full model\" = mod1,\n  \"Simplified model\" = mod2,\n  \"With interaction\" = mod3\n)\n\nggcoef_compare(models, type = \"faceted\")\n```\n\n## Compute custom proportions\n\n```{r}\nlibrary(ggplot2)\nggplot(as.data.frame(Titanic)) +\n  aes(x = Class, fill = Survived, weight = Freq, by = Class) +\n  geom_bar(position = \"fill\") +\n  geom_text(stat = \"prop\", position = position_fill(.5)) +\n  facet_grid(~Sex)\n```\n\n## Compute weighted mean\n\n```{r}\ndata(tips, package = \"reshape\")\nggplot(tips) +\n  aes(x = day, y = total_bill, fill = sex) +\n  stat_weighted_mean(geom = \"bar\", position = \"dodge\") +\n  ylab(\"Mean total bill per day and sex\")\n```\n\n## Compute cross-tabulation statistics\n\n```{r}\nggplot(as.data.frame(Titanic)) +\n  aes(\n    x = Class, y = Survived, weight = Freq,\n    size = after_stat(observed), fill = after_stat(std.resid)\n  ) +\n  stat_cross(shape = 22) +\n  scale_fill_steps2(breaks = c(-3, -2, 2, 3), show.limits = TRUE) +\n  scale_size_area(max_size = 20)\n```\n\n## Plot survey objects taking into account weights\n\n```{r}\nlibrary(survey, quietly = TRUE)\ndw \u003c- svydesign(\n  ids = ~1,\n  weights = ~Freq,\n  data = as.data.frame(Titanic)\n)\nggsurvey(dw) +\n  aes(x = Class, fill = Survived) +\n  geom_bar(position = \"fill\") +\n  ylab(\"Weighted proportion of survivors\")\n```\n\n## Plot Likert-type items\n\n```{r}\nlibrary(dplyr)\nlikert_levels \u003c- c(\n  \"Strongly disagree\",\n  \"Disagree\",\n  \"Neither agree nor disagree\",\n  \"Agree\",\n  \"Strongly agree\"\n)\nset.seed(42)\ndf \u003c-\n  tibble(\n    q1 = sample(likert_levels, 150, replace = TRUE),\n    q2 = sample(likert_levels, 150, replace = TRUE, prob = 5:1),\n    q3 = sample(likert_levels, 150, replace = TRUE, prob = 1:5),\n    q4 = sample(likert_levels, 150, replace = TRUE, prob = 1:5),\n    q5 = sample(c(likert_levels, NA), 150, replace = TRUE),\n    q6 = sample(likert_levels, 150, replace = TRUE, prob = c(1, 0, 1, 1, 0))\n  ) |\u003e\n  mutate(across(everything(), ~ factor(.x, levels = likert_levels)))\n\ngglikert(df)\n```\n\n## Connect bars\n\n```{r}\nggplot(diamonds) +\n  aes(x = clarity, fill = cut) +\n  geom_bar(width = .5) +\n  geom_bar_connector(width = .5, linewidth = .25) +\n  theme_minimal() +\n  theme(legend.position = \"bottom\")\n```\n\n\n## Generate a cascade plot\n\n```{r}\ndiamonds |\u003e\n  ggcascade(\n    all = TRUE,\n    big = carat \u003e .5,\n    \"big \u0026 ideal\" = carat \u003e .5 \u0026 cut == \"Ideal\"\n  )\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/larmarange.github.io%2Fggstats%2F","html_url":"https://awesome.ecosyste.ms/projects/larmarange.github.io%2Fggstats%2F","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/larmarange.github.io%2Fggstats%2F/lists"}