Skip to content

Commit

Permalink
Merge branch 'main' into fail-on-lints
Browse files Browse the repository at this point in the history
  • Loading branch information
IndrajeetPatil authored May 21, 2024
2 parents 3e77584 + 18c8921 commit 61606cf
Show file tree
Hide file tree
Showing 21 changed files with 247 additions and 30 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/pre-commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,11 @@ jobs:
access_token: ${{ github.token }}

- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v5
uses: actions/setup-python@v5.1.0
with:
python-version: "3.9"
python-version: "3.12"
architecture: "x64"

- name: Run pre-commit
Expand Down
36 changes: 31 additions & 5 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# CITATION file created with {cffr} R package
# See also: https://docs.ropensci.org/cffr/
# --------------------------------------------

cff-version: 1.2.0
message: 'To cite package "ggstatsplot" in publications use:'
type: software
Expand Down Expand Up @@ -278,7 +278,7 @@ references:
abstract: 'insight: Easy Access to Model Information for Various Model Objects'
notes: Imports
url: https://easystats.github.io/insight/
repository: https://easystats.r-universe.dev
repository: https://CRAN.R-project.org/package=insight
authors:
- family-names: Lüdecke
given-names: Daniel
Expand Down Expand Up @@ -313,7 +313,7 @@ references:
email: [email protected]
orcid: https://orcid.org/0000-0002-9271-5075
year: '2024'
version: '>= 0.19.10'
version: '>= 0.19.11'
- type: software
title: paletteer
abstract: 'paletteer: Comprehensive Collection of Color Palettes'
Expand All @@ -330,7 +330,7 @@ references:
abstract: 'parameters: Processing of Model Parameters'
notes: Imports
url: https://easystats.github.io/parameters/
repository: https://easystats.r-universe.dev
repository: https://CRAN.R-project.org/package=parameters
authors:
- family-names: Lüdecke
given-names: Daniel
Expand All @@ -356,7 +356,7 @@ references:
email: [email protected]
orcid: https://orcid.org/0000-0001-9560-6336
year: '2024'
version: '>= 0.21.6'
version: '>= 0.21.7'
- type: software
title: patchwork
abstract: 'patchwork: The Composer of Plots'
Expand Down Expand Up @@ -581,6 +581,18 @@ references:
given-names: Brian
email: [email protected]
year: '2024'
- type: software
title: metaBMA
abstract: 'metaBMA: Bayesian Model Averaging for Random and Fixed Effects Meta-Analysis'
notes: Suggests
url: https://danheck.github.io/metaBMA/
repository: https://CRAN.R-project.org/package=metaBMA
authors:
- family-names: Heck
given-names: Daniel W.
email: [email protected]
orcid: https://orcid.org/0000-0002-6302-9252
year: '2024'
- type: software
title: metafor
abstract: 'metafor: Meta-Analysis Package for R'
Expand All @@ -600,6 +612,20 @@ references:
value: https://wviechtb.github.io/metafor/
- type: url
value: https://www.wvbauer.com
- type: software
title: metaplus
abstract: 'metaplus: Robust Meta-Analysis and Meta-Regression'
notes: Suggests
repository: https://CRAN.R-project.org/package=metaplus
authors:
- family-names: Beath
given-names: Ken
email: [email protected]
- family-names: Bolker
given-names: Ben
email: [email protected]
- name: R Development Core Team
year: '2024'
- type: software
title: psych
abstract: 'psych: Procedures for Psychological, Psychometric, and Personality Research'
Expand Down
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ Imports:
ggside (>= 0.3.1),
ggsignif (>= 0.6.4),
glue (>= 1.7.0),
insight (>= 0.19.10),
insight (>= 0.19.11),
paletteer (>= 1.6.0),
parameters (>= 0.21.6),
parameters (>= 0.21.7),
patchwork (>= 1.2.0),
performance (>= 0.11.0),
purrr (>= 1.0.2),
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ N.B. All statistical analysis in `{ggstatsplot}` is carried out in
read the `NEWS` for that package:
<https://indrajeetpatil.github.io/statsExpressions/news/index.html>

## BUG FIXES

- Empty groups in factors are no longer dropped in `ggpiestats()` and `ggbarstats()` (#935).

# ggstatsplot 0.12.3

## MAJOR CHANGES
Expand Down
14 changes: 6 additions & 8 deletions R/ggbarstats.R
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ ggbarstats <- function(
# untable the data frame based on the count for each observation
if (".counts" %in% names(data)) data %<>% tidyr::uncount(weights = .counts)

# x and y need to be a factor; also drop the unused levels of the factors
data %<>% mutate(across(.cols = everything(), .fns = ~ droplevels(as.factor(.x))))
# x and y need to be a factor
data %<>% mutate(across(.cols = everything(), .fns = ~ as.factor(.x)))

# TO DO: until one-way table is supported by `BayesFactor`
if (nlevels(pull(data, {{ y }})) == 1L) c(bf.message, proportion.test) %<-% c(FALSE, FALSE)
Expand Down Expand Up @@ -126,7 +126,6 @@ ggbarstats <- function(
# if no. of factor levels is greater than the default palette color count
.is_palette_sufficient(package, palette, nlevels(pull(data, {{ x }})))

# plot
plotBar <- ggplot(descriptive_df, aes({{ y }}, perc, fill = {{ x }})) +
geom_bar(stat = "identity", position = "fill", color = "black") +
scale_y_continuous(
Expand All @@ -145,9 +144,8 @@ ggbarstats <- function(
guides(fill = guide_legend(title = legend.title %||% as_name(x))) +
paletteer::scale_fill_paletteer_d(paste0(package, "::", palette), name = "")

# sample size + proportion test ------------------------------------------
# proportion test ------------------------------------------

# adding significance labels to bars for proportion tests
if (isTRUE(proportion.test)) {
plotBar <- plotBar +
geom_text(
Expand All @@ -158,7 +156,8 @@ ggbarstats <- function(
)
}

# adding sample size info
# sample size -------------------------------------------------

plotBar <- plotBar +
exec(
geom_text,
Expand Down Expand Up @@ -207,13 +206,12 @@ ggbarstats <- function(
#' set.seed(123)
#' library(dplyr, warn.conflicts = FALSE)
#'
#' # let's create a smaller data frame
#' # let's create a smaller data frame first
#' diamonds_short <- ggplot2::diamonds %>%
#' filter(cut %in% c("Very Good", "Ideal")) %>%
#' filter(clarity %in% c("SI1", "SI2", "VS1", "VS2")) %>%
#' sample_frac(size = 0.05)
#'
#' # plot
#' grouped_ggbarstats(
#' data = diamonds_short,
#' x = color,
Expand Down
4 changes: 2 additions & 2 deletions R/ggpiestats.R
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ ggpiestats <- function(
# untable the data frame based on the count for each observation
if (".counts" %in% names(data)) data %<>% tidyr::uncount(weights = .counts)

# x and y need to be a factor; also drop the unused levels of the factors
data %<>% mutate(across(.cols = everything(), .fns = ~ droplevels(as.factor(.x))))
# x and y need to be a factor
data %<>% mutate(across(.cols = everything(), .fns = ~ as.factor(.x)))
x_levels <- nlevels(pull(data, {{ x }}))
y_levels <- ifelse(test == "one.way", 0L, nlevels(pull(data, {{ y }})))

Expand Down
4 changes: 2 additions & 2 deletions codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@
"@type": "SoftwareApplication",
"identifier": "insight",
"name": "insight",
"version": ">= 0.19.10",
"version": ">= 0.19.11",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
Expand All @@ -433,7 +433,7 @@
"@type": "SoftwareApplication",
"identifier": "parameters",
"name": "parameters",
"version": ">= 0.21.6",
"version": ">= 0.21.7",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
Expand Down
3 changes: 1 addition & 2 deletions man/grouped_ggbarstats.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added pkgdown/favicon/apple-touch-icon-120x120.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pkgdown/favicon/apple-touch-icon-152x152.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pkgdown/favicon/apple-touch-icon-180x180.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pkgdown/favicon/apple-touch-icon-60x60.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pkgdown/favicon/apple-touch-icon-76x76.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pkgdown/favicon/apple-touch-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pkgdown/favicon/favicon-16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pkgdown/favicon/favicon-32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pkgdown/favicon/favicon.ico
Binary file not shown.
72 changes: 72 additions & 0 deletions tests/testthat/_snaps/ggcoefstats/meta-analysis-works.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 61606cf

Please sign in to comment.