Skip to content

Commit

Permalink
cran submission
Browse files Browse the repository at this point in the history
  • Loading branch information
IndrajeetPatil committed Apr 12, 2021
1 parent 5015f4a commit 312f97b
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 85 deletions.
4 changes: 2 additions & 2 deletions CRAN-RELEASE
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
This package was submitted to CRAN on 2021-03-11.
Once it is accepted, delete this file and tag the release (commit 976bc8f2).
This package was submitted to CRAN on 2021-04-12.
Once it is accepted, delete this file and tag the release (commit 5015f4a2).
3 changes: 2 additions & 1 deletion R/attach.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.onAttach <- function(...) {
packageStartupMessage(
"You can cite this package as:
Patil, I. (2021). Visualizations with statistical details: The {'ggstatsplot'} approach. PsyArxiv. doi:10.31234/osf.io/p7mku"
Patil, I. (2021). Visualizations with statistical details: The 'ggstatsplot' approach.
PsyArxiv. doi:10.31234/osf.io/p7mku"
)
}
19 changes: 9 additions & 10 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-140-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-14-red.svg)](https://github.com/IndrajeetPatil/ggstatsplot/issues) | [![CodeFactor](https://www.codefactor.io/repository/github/indrajeetpatil/ggstatsplot/badge)](https://www.codefactor.io/repository/github/indrajeetpatil/ggstatsplot) |
| [![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-13-red.svg)](https://github.com/IndrajeetPatil/ggstatsplot/issues) | [![CodeFactor](https://www.codefactor.io/repository/github/indrajeetpatil/ggstatsplot/badge)](https://www.codefactor.io/repository/github/indrajeetpatil/ggstatsplot) |
| [![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--04--06-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--04--12-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 @@ -148,19 +148,18 @@ context, run the following code in your `R` console:
``` r
citation("ggstatsplot")

Patil, I. (2018). ggstatsplot: 'ggplot2' Based Plots with Statistical
Details. CRAN. doi:10.5281/zenodo.2074621. Retrieved from
https://cran.r-project.org/web/packages/ggstatsplot/index.html
Patil, I. (2018). Visualizations with statistical details: The
'ggstatsplot' approach. PsyArxiv. doi:10.31234/osf.io/p7mku

A BibTeX entry for LaTeX users is

@Article{,
title = {{ggstatsplot}: 'ggplot2' Based Plots with Statistical Details},
title = {Visualizations with statistical details: The 'ggstatsplot' approach},
author = {Indrajeet Patil},
year = {2018},
journal = {CRAN},
url = {https://CRAN.R-project.org/package=ggstatsplot},
doi = {10.5281/zenodo.2074621},
year = {2021},
journal = {PsyArxiv},
url = {https://psyarxiv.com/p7mku/},
doi = {10.31234/osf.io/p7mku},
}
```

Expand Down
44 changes: 22 additions & 22 deletions docs/articles/web_only/faq.html

Large diffs are not rendered by default.

Binary file modified docs/articles/web_only/faq_files/figure-html/ggbar_colors-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 0 additions & 27 deletions tests/testthat/test-ggbarstats.R
Original file line number Diff line number Diff line change
Expand Up @@ -137,33 +137,6 @@ test_that(
}
)

# without enough data ---------------------------------------------------------

test_that(
desc = "checking if functions work without enough data",
code = {
skip_on_cran()
set.seed(123)

# creating a dataframe
df <- tibble::tribble(
~x, ~y,
"one", "one"
)

# should not work
expect_s3_class(
suppressWarnings(ggbarstats(
data = df,
x = x,
y = y
)),
"ggplot"
)
}
)


# expression output --------------------------------------------------

test_that(
Expand Down
49 changes: 26 additions & 23 deletions vignettes/web_only/faq.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ output:
toc: true
warning: FALSE
message: FALSE
number_sections: true
vignette: >
%\VignetteIndexEntry{frequently asked questions (FAQ)}
%\VignetteEngine{knitr::rmarkdown}
Expand Down Expand Up @@ -39,18 +38,21 @@ You can cite this package/vignette as:
citation("ggstatsplot")
```

<!-- The sections are numbered manually because `pkgdown` doesn't render -->
<!-- numbered sections for `rmarkdown::html_vignette` format -->

---

Following are a few of the common questions asked in GitHub issues and on social
media platforms.

# I just want the plot, not the statistical details. How can I turn them off?
# 1. I just want the plot, not the statistical details. How can I turn them off?

All functions in `ggstatsplot` that display results from statistical analysis in
a subtitle have argument `results.subtitle`. Setting it to `FALSE` will return
only the plot.

# How can I customize the details contained in the subtitle?
# 2. How can I customize the details contained in the subtitle?

Sometimes you may not wish include so many details in the subtitle. In that
case, you can extract the expression and copy-paste only the part you wish to
Expand All @@ -76,7 +78,7 @@ ggplot(iris, aes(x = Species, y = Sepal.Length)) +
)))
```

# I am getting `Error in grid.Call` error
# 3. I am getting `Error in grid.Call` error

Sometimes, if you are working in `RStudio`, you might see the following error-

Expand All @@ -91,7 +93,7 @@ those solutions solve your problem.
If not, pray to the old and the new gods, and try again. It might just solve
your problem. `r emo::ji("shrug")`

# Why do I get only plot in return but not the subtitle/caption?
# 4. Why do I get only plot in return but not the subtitle/caption?

In order to prevent the function from failing when statistical analysis fails,
functions in `ggstatsplot` default to first attempting to run the analysis and
Expand Down Expand Up @@ -119,7 +121,7 @@ df <- data.frame(x = c("a", "b"), y = c(1, 2))
two_sample_test(data = df, x = x, y = y)
```

# What statistical test was carried out?
# 5. What statistical test was carried out?

In case you are not sure what was the statistical test that produced the results
shown in the subtitle of the plot, the best way to get that information is to
Expand All @@ -129,7 +131,7 @@ associated vignette.
Summary of all analysis is handily available in `README`:
<https://github.com/IndrajeetPatil/ggstatsplot/blob/master/README.md>

# How can I use `ggstatsplot` functions in a `for` loop?
# 6. How can I use `ggstatsplot` functions in a `for` loop?

Given that all functions in `ggstatsplot` use tidy evaluation, running these
functions in a `for` loop requires minor adjustment to how inputs are entered:
Expand All @@ -156,7 +158,7 @@ dataframe in what you want to do, I will recommend you to have a look at

<https://indrajeetpatil.github.io/ggstatsplot/articles/web_only/purrr_examples.html#repeating-function-execution-across-multiple-columns-in-a-dataframe-1>

# How can I have uniform Y-axes ranges in `grouped_` functions?
# 7. How can I have uniform Y-axes ranges in `grouped_` functions?

```{r grouped_y_axes, fig.height=10, fig.width=8}
# setup
Expand Down Expand Up @@ -190,7 +192,7 @@ combine_plots(
)
```

# Does `ggstatsplot` work with `plotly`?
# 8. Does `ggstatsplot` work with `plotly`?

The `plotly` R graphing library makes it easy to produce interactive web
graphics via `plotly.js`.
Expand All @@ -215,7 +217,7 @@ p <-
plotly::ggplotly(p, width = 480, height = 480)
```

# How can I use `grouped_` functions with more than one group?
# 9. How can I use `grouped_` functions with more than one group?

Currently, the `grouped_` variants of functions only support repeating the
analysis across a _single_ grouping variable. Often, you have to run the same
Expand Down Expand Up @@ -261,7 +263,7 @@ ggstatsplot::combine_plots(
)
```

# How can I include statistical expressions in facet labels?
# 10. How can I include statistical expressions in facet labels?

```{r facet_expr, fig.width = 6, fig.height = 8}
set.seed(123)
Expand Down Expand Up @@ -292,7 +294,7 @@ mtcars1 %>%
)
```

# Can you customize which pairs are shown in pairwise comparisons?
# 11. Can you customize which pairs are shown in pairwise comparisons?

Currently, for `ggbetweenstats` and `ggwithinstats`, you can either display all
**significant** comparisons, all **non-significant** comparisons, or **all**
Expand All @@ -310,7 +312,7 @@ ggbetweenstats(mtcars, cyl, wt, pairwise.comparisons = FALSE) +
geom_signif(comparisons = list(c("4", "6")))
```

# How to access dataframe with results from pairwise comparisons?
# 12. How to access dataframe with results from pairwise comparisons?

```{r}
library(ggstatsplot)
Expand All @@ -331,7 +333,7 @@ library(pairwiseComparisons)
pairwise_comparisons(mtcars, cyl, wt)
```

# How can I change annotation in pairwise comparisons?
# 13. How can I change annotation in pairwise comparisons?

`ggstatsplot` defaults to displaying exact p-values or logged Bayes Factor
values for pairwise comparisons. But what if you wish to adopt a different
Expand Down Expand Up @@ -373,7 +375,7 @@ p +
)
```

# How to access dataframe with results from `ggpiestats` and `ggbarstats`?
# 14. How to access dataframe with results from `ggpiestats` and `ggbarstats`?

```{r proptest_df}
# setup
Expand All @@ -393,7 +395,7 @@ pb$plot$plot_env$df_proptest
pb$plot$plot_env$df_descriptive
```

# How can I remove a particular `geom` layer from the plot?
# 15. How can I remove a particular `geom` layer from the plot?

Sometimes you may not want a particular `geom` layer to be displayed. You can
remove them using `gginnards`.
Expand Down Expand Up @@ -446,12 +448,12 @@ p <- gginnards::delete_layers(x = p, match_type = "GeomPoint")
p + geom_point(shape = 23, aes(color = am))
```

# How can I modify the fill colors with custom values?
# 16. How can I modify the fill colors with custom values?

Sometimes you may not be satisfied with the available color palette values. In
this case, you can also change the colors by manually specifying these values.

```{r ggbar_colors, fig.width = 3, fig.height = 3}
```{r ggbar_colors, fig.width = 5, fig.height = 5}
# needed libraries
set.seed(123)
library(ggstatsplot)
Expand All @@ -472,7 +474,7 @@ ggstatsplot::grouped_ggpiestats(
)
```

# How can I modify `grouped_` outputs using `ggplot2` functions?
# 17. How can I modify `grouped_` outputs using `ggplot2` functions?

All `ggstatsplot` are `ggplot` objects, which can be further modified, just like
any other `ggplot` object. But exception to these are all plots returned by
Expand Down Expand Up @@ -502,15 +504,15 @@ grouped_ggbetweenstats(
)
```

# How can I extract dataframe containing results from `ggstatsplot`?
# 18. How can I extract dataframe containing results from `ggstatsplot`?

`ggstatsplot` can return expressions in the subtitle and caption, but what if
you want to actually get back dataframe containing the results?

This is possible via `statsExpressions`:
<https://indrajeetpatil.github.io/statsExpressions/articles/dataframe_outputs.html>

# How can I remove sample size labels for `ggbarstats`?
# 19. How can I remove sample size labels for `ggbarstats`?

```{r ggbar_samplesize}
library(ggstatsplot)
Expand All @@ -523,15 +525,16 @@ p <- ggbarstats(mtcars, am, cyl)
delete_layers(p, "GeomText")
```

# Test I need is not available. What can I do?
# 20. Test I need is not available. What can I do?

By default, since `ggstatsplot` always allows just **one** type of test per
statistical approach, sometimes your favorite test might not be available. For
example, `ggstatsplot` provides only Spearman's $\rho$, but not Kendall's
$\tau$ as a non-parametric correlation test.

In such cases, you can override the defaults and use `statsExpressions` to
create custom expressions to display in the plot.
create custom expressions to display in the plot. But be forewarned that the
expression building functions in `statsExpressions` are not stable yet.

```{r custom_test, fig.width = 6, fig.height = 6}
# setup
Expand Down

2 comments on commit 312f97b

@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 24.

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/ggscatterstats.R:96:1: style: functions should have cyclomatic complexity of less than 15, this has 16.

ggscatterstats <- function(data,
^

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

ggwithinstats <- function(data,
^

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

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

tests/testthat/test-ggwithinstats.R:176:17: 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 24.

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:191: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/ggscatterstats.R:96:1: style: functions should have cyclomatic complexity of less than 15, this has 16.

ggscatterstats <- function(data,
^

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

ggwithinstats <- function(data,
^

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

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

tests/testthat/test-ggwithinstats.R:176:17: style: Commented code should be removed.

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

Please sign in to comment.