Skip to content

Commit

Permalink
address (partly) #537
Browse files Browse the repository at this point in the history
  • Loading branch information
IndrajeetPatil committed Mar 10, 2021
1 parent 7defb64 commit 195029d
Show file tree
Hide file tree
Showing 16 changed files with 339 additions and 209 deletions.
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ MINOR CHANGES
not do this. If the users wish to not display sample sizes, they can easily
do this using `scale_*` functions from `ggplot2`.

- In `ggpiestats` and `ggbarstats`, parametric proportion tests are now turned
off when `type = "bayes"`.

# ggstatsplot 0.7.0

BREAKING CHANGES
Expand Down
1 change: 1 addition & 0 deletions R/ggbarstats.R
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ ggbarstats <- function(data,

# TO DO: until one-way table is supported by `BayesFactor`
if (nlevels(data %>% dplyr::pull({{ y }})) == 1L) c(bf.message, proportion.test) %<-% c(FALSE, FALSE)
if (type == "bayes") proportion.test <- FALSE

# -------------------------- statistical analysis --------------------------

Expand Down
2 changes: 1 addition & 1 deletion R/ggpiestats.R
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ ggpiestats <- function(data,

# faceting is happening only if both vars have more than one levels
facet <- ifelse(y_levels > 1L, TRUE, FALSE)
if (x_levels == 1L && isTRUE(facet)) proportion.test <- FALSE
if ((x_levels == 1L && isTRUE(facet)) || type == "bayes") proportion.test <- FALSE

# -------------------------- statistical analysis --------------------------

Expand Down
11 changes: 5 additions & 6 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -1097,7 +1097,7 @@ also supported by `ggcoefstats`. For example-
`lmodel2`, `lmRob`, `lmrob`, `lm_robust`, `logitmfx`, `logitor`, `logitsf`,
`LORgee`, `lqm`, `lqmm`, `lrm`, `manova`, `maov`, `margins`, `mcmc`,
`mcmc.list`, `MCMCglmm`, `mclogit`, `mice`, `mmclogit`, `mediate`, `metafor`,
`merMod`, `merModList`, `metaplus`, `mixor`, `mjoint`, `mle2`, `mlm`,
`merMod`, `merModList`, `metaplus`, `mhurdle`, `mixor`, `mjoint`, `mle2`, `mlm`,
`multinom`, `negbin`, `negbinmfx`, `negbinirr`, `nlmerMod`, `nlrq`, `nlreg`,
`nls`, `orcutt`, `orm`, `plm`, `poissonmfx`, `poissonirr`, `polr`, `probitmfx`,
`ridgelm`, `riskRegression`, `rjags`, `rlm`, `rlmerMod`, `robmixglm`, `rq`,
Expand All @@ -1106,16 +1106,16 @@ also supported by `ggcoefstats`. For example-
`svyolr`, `tobit`, `truncreg`, `varest`, `vgam`, `vglm`, `wbgee`, `wblm`,
`zeroinfl`, etc.

Although not shown here, this function can also be used to carry out both
frequentist, robust, and Bayesian random-effects meta-analysis.
Although not shown here, this function can also be used to carry out parametric,
robust, and Bayesian random-effects meta-analysis.

### Summary of meta-analysis tests

Type | Test | Effect size | 95% CI available? | Function used
----------- | -------------------- | -------- | --- | -----
Parametric | Meta-analysis via random-effects models | $\beta$ | <font color="green">Yes<font> | `metafor::metafor`
Robust | Meta-analysis via robust random-effects models | $\beta$ | <font color="green">Yes<font> | `metaplus::metaplus`
Bayes | Meta-analysis via robust random-effects models | $\beta$ | <font color="green">Yes<font> | `metaBMA::meta_random`
Bayes | Meta-analysis via Bayesian random-effects models | $\beta$ | <font color="green">Yes<font> | `metaBMA::meta_random`

For a more exhaustive account of this function, see the associated vignette-
<https://indrajeetpatil.github.io/ggstatsplot/articles/web_only/ggcoefstats.html>
Expand All @@ -1125,8 +1125,7 @@ For a more exhaustive account of this function, see the associated vignette-
The full power of `ggstatsplot` can be leveraged with a functional programming
package like [`purrr`](https://purrr.tidyverse.org/) that replaces `for` loops
with code that is both more succinct and easier to read and, therefore, `purrr`
should be preferrred `r emo::ji("heart_eyes_cat")`. (Another old school option
to do this effectively is using the `plyr` package.)
should be preferrred `r emo::ji("heart_eyes_cat")`.

In such cases, `ggstatsplot` contains a helper function `combine_plots` to
combine multiple plots, which can be useful for combining a list of plots
Expand Down
25 changes: 12 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [![CRAN\_Release\_Badge](https://www.r-pkg.org/badges/version-ago/ggstatsplot)](https://CRAN.R-project.org/package=ggstatsplot) | [![Travis Build Status](https://travis-ci.org/IndrajeetPatil/ggstatsplot.svg?branch=master)](https://travis-ci.org/IndrajeetPatil/ggstatsplot) | [![Daily downloads badge](https://cranlogs.r-pkg.org/badges/last-day/ggstatsplot?color=blue)](https://CRAN.R-project.org/package=ggstatsplot) | [![GitHub version](https://img.shields.io/badge/GitHub-0.6.8.9000-orange.svg?style=flat-square)](https://github.com/IndrajeetPatil/ggstatsplot/) | [![Website](https://img.shields.io/badge/website-ggstatsplot-orange.svg?colorB=E91E63)](https://indrajeetpatil.github.io/ggstatsplot/) |
| [![CRAN Checks](https://cranchecks.info/badges/summary/ggstatsplot)](https://cran.r-project.org/web/checks/check_results_ggstatsplot.html) | [![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/IndrajeetPatil/ggstatsplot?branch=master&svg=true)](https://ci.appveyor.com/project/IndrajeetPatil/ggstatsplot) | [![Weekly downloads badge](https://cranlogs.r-pkg.org/badges/last-week/ggstatsplot?color=blue)](https://CRAN.R-project.org/package=ggstatsplot) | [![Forks](https://img.shields.io/badge/forks-133-blue.svg)](https://github.com/IndrajeetPatil/ggstatsplot/) | [![minimal R version](https://img.shields.io/badge/R%3E%3D-3.6.0-6666ff.svg)](https://cran.r-project.org/) |
| [![lifecycle](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://lifecycle.r-lib.org/articles/stages.html) | [![R build status](https://github.com/IndrajeetPatil/ggstatsplot/workflows/R-CMD-check/badge.svg)](https://github.com/IndrajeetPatil/ggstatsplot) | [![Monthly downloads badge](https://cranlogs.r-pkg.org/badges/last-month/ggstatsplot?color=blue)](https://CRAN.R-project.org/package=ggstatsplot) | [![Github Issues](https://img.shields.io/badge/issues-9-red.svg)](https://github.com/IndrajeetPatil/ggstatsplot/issues) | [![vignettes](https://img.shields.io/badge/vignettes-0.6.5-orange.svg?colorB=FF5722)](https://indrajeetpatil.github.io/ggstatsplot/articles/) |
| [![lifecycle](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://lifecycle.r-lib.org/articles/stages.html) | [![R build status](https://github.com/IndrajeetPatil/ggstatsplot/workflows/R-CMD-check/badge.svg)](https://github.com/IndrajeetPatil/ggstatsplot) | [![Monthly downloads badge](https://cranlogs.r-pkg.org/badges/last-month/ggstatsplot?color=blue)](https://CRAN.R-project.org/package=ggstatsplot) | [![Github Issues](https://img.shields.io/badge/issues-10-red.svg)](https://github.com/IndrajeetPatil/ggstatsplot/issues) | [![vignettes](https://img.shields.io/badge/vignettes-0.6.5-orange.svg?colorB=FF5722)](https://indrajeetpatil.github.io/ggstatsplot/articles/) |
| [![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/IndrajeetPatil/ggstatsplot.svg)](https://github.com/IndrajeetPatil/ggstatsplot) | [![Coverage Status](https://coveralls.io/repos/github/IndrajeetPatil/ggstatsplot/badge.svg?branch=master)](https://coveralls.io/github/IndrajeetPatil/ggstatsplot?branch=master) | [![Total downloads badge](https://cranlogs.r-pkg.org/badges/grand-total/ggstatsplot?color=blue)](https://CRAN.R-project.org/package=ggstatsplot) | [![Github Stars](https://img.shields.io/github/stars/IndrajeetPatil/ggstatsplot.svg?style=social&label=Github)](https://github.com/IndrajeetPatil/ggstatsplot) | [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.2074621.svg)](https://doi.org/10.5281/zenodo.2074621) |
| [![Licence](https://img.shields.io/badge/licence-GPL--3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0.en.html) | [![Codecov test coverage](https://codecov.io/gh/IndrajeetPatil/ggstatsplot/branch/master/graph/badge.svg)](https://codecov.io/gh/IndrajeetPatil/ggstatsplot?branch=master) | [![HitCount](https://hits.dwyl.com/IndrajeetPatil/ggstatsplot.svg)](https://hits.dwyl.com/IndrajeetPatil/ggstatsplot) | [![Last-changedate](https://img.shields.io/badge/last%20change-2021--03--07-yellowgreen.svg)](https://github.com/IndrajeetPatil/ggstatsplot/commits/master) | [![GitHub last commit](https://img.shields.io/github/last-commit/IndrajeetPatil/ggstatsplot.svg)](https://github.com/IndrajeetPatil/ggstatsplot/commits/master) |
| [![Licence](https://img.shields.io/badge/licence-GPL--3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0.en.html) | [![Codecov test coverage](https://codecov.io/gh/IndrajeetPatil/ggstatsplot/branch/master/graph/badge.svg)](https://codecov.io/gh/IndrajeetPatil/ggstatsplot?branch=master) | [![HitCount](https://hits.dwyl.com/IndrajeetPatil/ggstatsplot.svg)](https://hits.dwyl.com/IndrajeetPatil/ggstatsplot) | [![Last-changedate](https://img.shields.io/badge/last%20change-2021--03--10-yellowgreen.svg)](https://github.com/IndrajeetPatil/ggstatsplot/commits/master) | [![GitHub last commit](https://img.shields.io/github/last-commit/IndrajeetPatil/ggstatsplot.svg)](https://github.com/IndrajeetPatil/ggstatsplot/commits/master) |
| [![status](https://tinyverse.netlify.com/badge/ggstatsplot)](https://CRAN.R-project.org/package=ggstatsplot) | [![lints](https://github.com/IndrajeetPatil/ggstatsplot/workflows/lint/badge.svg)](https://github.com/IndrajeetPatil/ggstatsplot) | [![Gitter chat](https://badges.gitter.im/gitterHQ/gitter.png)](https://gitter.im/ggstatsplot/community) | [![Project Status](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active) | [![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/IndrajeetPatil/ggstatsplot/issues) |

# Raison d’être <img src="man/figures/logo.png" align="right" width="360" />
Expand Down Expand Up @@ -1229,25 +1229,25 @@ packages are also supported by `ggcoefstats`. For example-
`logitmfx`, `logitor`, `logitsf`, `LORgee`, `lqm`, `lqmm`, `lrm`,
`manova`, `maov`, `margins`, `mcmc`, `mcmc.list`, `MCMCglmm`, `mclogit`,
`mice`, `mmclogit`, `mediate`, `metafor`, `merMod`, `merModList`,
`metaplus`, `mixor`, `mjoint`, `mle2`, `mlm`, `multinom`, `negbin`,
`negbinmfx`, `negbinirr`, `nlmerMod`, `nlrq`, `nlreg`, `nls`, `orcutt`,
`orm`, `plm`, `poissonmfx`, `poissonirr`, `polr`, `probitmfx`,
`metaplus`, `mhurdle`, `mixor`, `mjoint`, `mle2`, `mlm`, `multinom`,
`negbin`, `negbinmfx`, `negbinirr`, `nlmerMod`, `nlrq`, `nlreg`, `nls`,
`orcutt`, `orm`, `plm`, `poissonmfx`, `poissonirr`, `polr`, `probitmfx`,
`ridgelm`, `riskRegression`, `rjags`, `rlm`, `rlmerMod`, `robmixglm`,
`rq`, `rqs`, `rqss`, `rrvglm`, `scam`, `semLm`, `semLme`, `slm`,
`speedglm`, `speedlm`, `stanfit`, `stanreg`, `summary.lm`, `survreg`,
`svyglm`, `svy_vglm`, `svyolr`, `tobit`, `truncreg`, `varest`, `vgam`,
`vglm`, `wbgee`, `wblm`, `zeroinfl`, etc.

Although not shown here, this function can also be used to carry out
both frequentist, robust, and Bayesian random-effects meta-analysis.
parametric, robust, and Bayesian random-effects meta-analysis.

### Summary of meta-analysis tests

| Type | Test | Effect size | 95% CI available? | Function used |
|------------|------------------------------------------------|---------------------------------------------------------------------------|-------------------------------|------------------------|
| Parametric | Meta-analysis via random-effects models | ![\\beta](https://chart.apis.google.com/chart?cht=tx&chl=%5Cbeta "\beta") | <font color="green">Yes<font> | `metafor::metafor` |
| Robust | Meta-analysis via robust random-effects models | ![\\beta](https://chart.apis.google.com/chart?cht=tx&chl=%5Cbeta "\beta") | <font color="green">Yes<font> | `metaplus::metaplus` |
| Bayes | Meta-analysis via robust random-effects models | ![\\beta](https://chart.apis.google.com/chart?cht=tx&chl=%5Cbeta "\beta") | <font color="green">Yes<font> | `metaBMA::meta_random` |
| Type | Test | Effect size | 95% CI available? | Function used |
|------------|--------------------------------------------------|---------------------------------------------------------------------------|-------------------------------|------------------------|
| Parametric | Meta-analysis via random-effects models | ![\\beta](https://chart.apis.google.com/chart?cht=tx&chl=%5Cbeta "\beta") | <font color="green">Yes<font> | `metafor::metafor` |
| Robust | Meta-analysis via robust random-effects models | ![\\beta](https://chart.apis.google.com/chart?cht=tx&chl=%5Cbeta "\beta") | <font color="green">Yes<font> | `metaplus::metaplus` |
| Bayes | Meta-analysis via Bayesian random-effects models | ![\\beta](https://chart.apis.google.com/chart?cht=tx&chl=%5Cbeta "\beta") | <font color="green">Yes<font> | `metaBMA::meta_random` |

For a more exhaustive account of this function, see the associated
vignette-
Expand All @@ -1258,8 +1258,7 @@ vignette-
The full power of `ggstatsplot` can be leveraged with a functional
programming package like [`purrr`](https://purrr.tidyverse.org/) that
replaces `for` loops with code that is both more succinct and easier to
read and, therefore, `purrr` should be preferrred 😻. (Another old school
option to do this effectively is using the `plyr` package.)
read and, therefore, `purrr` should be preferrred 😻.

In such cases, `ggstatsplot` contains a helper function `combine_plots`
to combine multiple plots, which can be useful for combining a list of
Expand Down
2 changes: 1 addition & 1 deletion codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,6 @@
}
],
"funder": {},
"fileSize": "99637.067KB",
"fileSize": "99638.352KB",
"readme": "https://github.com/IndrajeetPatil/ggstatsplot/blob/master/README.md"
}
Loading

2 comments on commit 195029d

@lintr-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

data-raw/Titanic_full.R:16:10: warning: 1:nrow(...) is likely to be wrong in the empty edge case, use seq_len.

df[rep(1:nrow(df), rep), ]
         ^

R/ggbarstats.R:44:1: style: functions should have cyclomatic complexity of less than 15, this has 16.

ggbarstats <- function(data,
^

R/ggbetweenstats.R:165:1: style: functions should have cyclomatic complexity of less than 15, this has 22.

ggbetweenstats <- function(data,
^

R/ggcoefstats.R:133:1: style: functions should have cyclomatic complexity of less than 15, this has 43.

ggcoefstats <- function(x,
^

R/ggcorrmat.R:97:1: style: functions should have cyclomatic complexity of less than 15, this has 18.

ggcorrmat <- function(data,
^

R/ggpiestats.R:71:1: style: functions should have cyclomatic complexity of less than 15, this has 29.

ggpiestats <- function(data,
^

R/ggwithinstats.R:75:1: style: functions should have cyclomatic complexity of less than 15, this has 25.

ggwithinstats <- function(data,
^

tests/testthat/test-ggbetweenstats.R:91:13: style: Commented code should be removed.

#       bold("only significant")
            ^~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-ggwithinstats.R:174:15: style: Commented code should be removed.

#       bold("only significant")
              ^~~~~~~~~~~~~~~~~~~~~~~~

@lintr-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

data-raw/Titanic_full.R:16:10: warning: 1:nrow(...) is likely to be wrong in the empty edge case, use seq_len.

df[rep(1:nrow(df), rep), ]
         ^

R/ggbarstats.R:44:1: style: functions should have cyclomatic complexity of less than 15, this has 16.

ggbarstats <- function(data,
^

R/ggbetweenstats.R:165:1: style: functions should have cyclomatic complexity of less than 15, this has 22.

ggbetweenstats <- function(data,
^

R/ggcoefstats.R:133:1: style: functions should have cyclomatic complexity of less than 15, this has 43.

ggcoefstats <- function(x,
^

R/ggcorrmat.R:97:1: style: functions should have cyclomatic complexity of less than 15, this has 18.

ggcorrmat <- function(data,
^

R/ggcorrmat.R:159:3: warning: local variable ‘corr.nature’ assigned but may not be used

corr.nature <- ifelse(isTRUE(partial), "correlation (partial):", "correlation:")
  ^~~~~~~~~~~

R/ggcorrmat.R:192:3: warning: local variable ‘getmode’ assigned but may not be used

getmode <- function(v) {
  ^~~~~~~

R/ggpiestats.R:71:1: style: functions should have cyclomatic complexity of less than 15, this has 29.

ggpiestats <- function(data,
^

R/ggwithinstats.R:75:1: style: functions should have cyclomatic complexity of less than 15, this has 25.

ggwithinstats <- function(data,
^

tests/testthat/test-ggbetweenstats.R:91:13: style: Commented code should be removed.

#       bold("only significant")
            ^~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-ggwithinstats.R:174:15: style: Commented code should be removed.

#       bold("only significant")
              ^~~~~~~~~~~~~~~~~~~~~~~~

Please sign in to comment.