Skip to content

Commit

Permalink
Merge 97a5720 into 63babd4
Browse files Browse the repository at this point in the history
  • Loading branch information
IndrajeetPatil committed Dec 20, 2019
2 parents 63babd4 + 97a5720 commit 3fa57fc
Show file tree
Hide file tree
Showing 142 changed files with 1,426 additions and 1,387 deletions.
7 changes: 3 additions & 4 deletions DESCRIPTION
@@ -1,7 +1,7 @@
Type: Package
Package: ggstatsplot
Title: 'ggplot2' Based Plots with Statistical Details
Version: 0.1.4
Version: 0.1.4.9000
Authors@R:
c(person(given = "Indrajeet",
family = "Patil",
Expand Down Expand Up @@ -31,7 +31,7 @@ BugReports: https://github.com/IndrajeetPatil/ggstatsplot/issues
Depends:
R (>= 3.5.0)
Imports:
broomExtra (>= 0.0.6),
broomExtra (>= 1.0.0),
cowplot (>= 1.0.0),
crayon (>= 1.3.4),
dplyr (>= 0.8.3),
Expand All @@ -46,7 +46,7 @@ Imports:
insight (>= 0.7.1),
metaBMA (>= 0.6.2),
metafor (>= 2.1-0),
pairwiseComparisons (>= 0.1.2),
pairwiseComparisons (>= 0.1.3),
paletteer (>= 1.0.0),
parameters (>= 0.3.0),
psych (>= 1.8.12),
Expand All @@ -61,7 +61,6 @@ Imports:
Suggests:
broom,
broom.mixed,
jmv,
knitr,
lme4,
MASS,
Expand Down
1 change: 0 additions & 1 deletion NAMESPACE
Expand Up @@ -105,7 +105,6 @@ importFrom(metaBMA,meta_random)
importFrom(metafor,rma)
importFrom(pairwiseComparisons,p_adjust_text)
importFrom(pairwiseComparisons,pairwise_comparisons)
importFrom(pairwiseComparisons,pairwise_comparisons_caption)
importFrom(pairwiseComparisons,pairwise_p)
importFrom(paletteer,scale_color_paletteer_d)
importFrom(paletteer,scale_fill_paletteer_d)
Expand Down
6 changes: 6 additions & 0 deletions NEWS.md
@@ -1,3 +1,9 @@
# ggstatsplot 0.1.4.9000

MINOR CHANGES

- New dataset included: `bugs_wide`

# ggstatsplot 0.1.4

BUG FIXES
Expand Down
30 changes: 30 additions & 0 deletions R/data.R
Expand Up @@ -237,3 +237,33 @@
#' head(bugs_long)
#' dplyr::glimpse(bugs_long)
"bugs_long"


#' @title Wide-format version of the "Bugs" dataset.
#' @name bugs_wide
#' @details This data set, "Bugs", provides the extent to which men and women
#' want to kill arthropods that vary in freighteningness (low, high) and
#' disgustingness (low, high). Each participant rates their attitudes towards
#' all anthropods. Subset of the data reported by Ryan et al. (2013).
#'
#' @format A data frame with 93 rows and 6 variables
#' \itemize{
#' \item subject. Dummy identity number for each participant.
#' \item gender. Participant's gender (Female, Male).
#' \item region. Region of the world the participant was from.
#' \item education. Level of education.
#' \item ldlf,ldhf,hdlf,hdhf.The desire to kill an arthropod was indicated on
#' a scale from 0 to 10 in each condition of the experiment (**LDLF**: low
#' freighteningness and low disgustingness; **LFHD**: low freighteningness and
#' high disgustingness; **HFHD**: high freighteningness and low
#' disgustingness; **HFHD**: high freighteningness and high disgustingness).
#' }
#'
#' @source
#' \url{https://www.sciencedirect.com/science/article/pii/S0747563213000277}
#'
#' @examples
#' dim(bugs_wide)
#' head(bugs_wide)
#' dplyr::glimpse(bugs_wide)
"bugs_wide"
13 changes: 2 additions & 11 deletions R/ggbarstats.R
Expand Up @@ -46,22 +46,13 @@
#' # association test (or contingency table analysis)
#' ggstatsplot::ggbarstats(
#' data = mtcars,
#' main = vs,
#' condition = cyl,
#' x = vs,
#' y = cyl,
#' nboot = 10,
#' labels.legend = c("0 = V-shaped", "1 = straight"),
#' legend.title = "Engine"
#' )
#'
#' # using `counts` argument
#' library(jmv)
#'
#' ggstatsplot::ggbarstats(
#' data = as.data.frame(HairEyeColor),
#' x = Eye,
#' y = Hair,
#' counts = Freq
#' )
#' @export

# defining the function
Expand Down
11 changes: 2 additions & 9 deletions R/ggbetweenstats.R
Expand Up @@ -129,7 +129,7 @@
#' @importFrom paletteer scale_color_paletteer_d scale_fill_paletteer_d
#' @importFrom ggsignif geom_signif
#' @importFrom statsExpressions bf_ttest bf_oneway_anova
#' @importFrom pairwiseComparisons pairwise_comparisons pairwise_comparisons_caption
#' @importFrom pairwiseComparisons pairwise_comparisons
#'
#' @seealso \code{\link{grouped_ggbetweenstats}}, \code{\link{ggwithinstats}},
#' \code{\link{grouped_ggwithinstats}}
Expand Down Expand Up @@ -566,14 +566,7 @@ ggbetweenstats <- function(data,
)

# preparing the caption for pairwise comparisons test
caption <-
pairwiseComparisons::pairwise_comparisons_caption(
type = type,
var.equal = var.equal,
paired = FALSE,
p.adjust.method = p.adjust.method,
caption = caption
)
caption <- pairwise_caption(caption, unique(df_pairwise$test.details), p.adjust.method)
}

# ------------------------ annotations and themes -------------------------
Expand Down
8 changes: 0 additions & 8 deletions R/ggpiestats.R
Expand Up @@ -98,14 +98,6 @@
#' legend.title = "Engine"
#' )
#'
#' # using `counts` argument
#' library(jmv, warn.conflicts = FALSE)
#'
#' ggstatsplot::ggpiestats(
#' data = as.data.frame(HairEyeColor),
#' x = Eye,
#' counts = Freq
#' )
#' @export

# defining the function
Expand Down
11 changes: 2 additions & 9 deletions R/ggwithinstats.R
Expand Up @@ -19,7 +19,7 @@
#'
#' @importFrom rlang exec !! enquo :=
#' @importFrom statsExpressions bf_ttest bf_oneway_anova
#' @importFrom pairwiseComparisons pairwise_comparisons pairwise_comparisons_caption
#' @importFrom pairwiseComparisons pairwise_comparisons
#'
#' @details
#'
Expand Down Expand Up @@ -397,14 +397,7 @@ ggwithinstats <- function(data,
)

# preparing the caption for pairwise comparisons test
caption <-
pairwiseComparisons::pairwise_comparisons_caption(
type = type,
var.equal = TRUE,
paired = TRUE,
p.adjust.method = p.adjust.method,
caption = caption
)
caption <- pairwise_caption(caption, unique(df_pairwise$test.details), p.adjust.method)
}

# ------------------------ annotations and themes -------------------------
Expand Down
15 changes: 0 additions & 15 deletions R/grouped_ggbarstats.R
Expand Up @@ -24,18 +24,6 @@
#'
#' @examples
#' \donttest{
#' # with condition and with count data
#' library(jmv)
#'
#' ggstatsplot::grouped_ggbarstats(
#' data = as.data.frame(HairEyeColor),
#' x = Hair,
#' y = Eye,
#' counts = Freq,
#' grouping.var = Sex
#' )
#'
#' # the following will take slightly more amount of time
#' # for reproducibility
#' set.seed(123)
#'
Expand All @@ -51,11 +39,8 @@
#' x = color,
#' y = clarity,
#' grouping.var = cut,
#' sampling.plan = "poisson",
#' title.prefix = "Quality",
#' bar.label = "both",
#' messages = FALSE,
#' perc.k = 1,
#' nrow = 2
#' )
#' }
Expand Down
10 changes: 0 additions & 10 deletions R/grouped_ggpiestats.R
Expand Up @@ -28,16 +28,6 @@
#' x = cyl
#' )
#'
#' # without condition and with count data
#' library(jmv)
#'
#' ggstatsplot::grouped_ggpiestats(
#' data = as.data.frame(HairEyeColor),
#' x = Hair,
#' counts = Freq,
#' grouping.var = Sex
#' )
#'
#' # the following will take slightly more amount of time
#' # for reproducibility
#' set.seed(123)
Expand Down
26 changes: 25 additions & 1 deletion R/helpers_ggbetweenstats_graphics.R
Expand Up @@ -307,7 +307,8 @@ outlier_df <- function(data,
#' library(ggplot2)
#'
#' # plot
#' p <- ggplot(iris, aes(Species, Sepal.Length)) + geom_boxplot()
#' p <- ggplot(iris, aes(Species, Sepal.Length)) +
#' geom_boxplot()
#'
#' # dataframe with pairwise comparison test results
#' df_pair <- pairwiseComparisons::pairwise_comparisons(
Expand Down Expand Up @@ -393,6 +394,29 @@ ggsignif_adder <- function(plot,
return(plot)
}

#' @name pairwise_caption
#' @noRd

pairwise_caption <- function(caption, test.description, p.adjust.method) {
substitute(
atop(
displaystyle(top.text),
expr = paste(
"Pairwise comparisons: ",
bold(test.description),
"; Adjustment (p-value): ",
bold(p.adjust.method.text)
)
),
env = list(
top.text = caption,
test.description = test.description,
p.adjust.method.text = p_adjust_text(p.adjust.method)
)
)
}


#' @name ggsignif_xy
#' @importFrom utils combn
#'
Expand Down
4 changes: 1 addition & 3 deletions README.Rmd
Expand Up @@ -424,9 +424,7 @@ ggstatsplot::ggwithinstats(
y = Taste,
sort = "descending", # ordering groups along the x-axis based on
sort.fun = median, # values of `y` variable
pairwise.comparisons = TRUE,
pairwise.display = "s",
pairwise.annotation = "p",
pairwise.comparisons = TRUE, # show pairwise comparison test results
title = "Wine tasting",
caption = "Data from: `WRS2` R package",
ggtheme = ggthemes::theme_fivethirtyeight(),
Expand Down
10 changes: 4 additions & 6 deletions README.md
Expand Up @@ -7,9 +7,9 @@
| --------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [![CRAN\_Release\_Badge](http://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.1.3.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-85-blue.svg)](https://github.com/IndrajeetPatil/ggstatsplot/) | [![Rdoc](https://www.rdocumentation.org/badges/version/ggstatsplot)](https://www.rdocumentation.org/packages/ggstatsplot) |
| [![minimal R version](https://img.shields.io/badge/R%3E%3D-3.5.0-6666ff.svg)](https://cran.r-project.org/) | [![lifecycle](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://www.tidyverse.org/lifecycle/) | [![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-24-red.svg)](https://github.com/IndrajeetPatil/ggstatsplot/issues) | [![vignettes](https://img.shields.io/badge/vignettes-0.1.3-orange.svg?colorB=FF5722)](https://CRAN.R-project.org/package=ggstatsplot/vignettes/) |
| [![minimal R version](https://img.shields.io/badge/R%3E%3D-3.5.0-6666ff.svg)](https://cran.r-project.org/) | [![lifecycle](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://www.tidyverse.org/lifecycle/) | [![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-23-red.svg)](https://github.com/IndrajeetPatil/ggstatsplot/issues) | [![vignettes](https://img.shields.io/badge/vignettes-0.1.3-orange.svg?colorB=FF5722)](https://CRAN.R-project.org/package=ggstatsplot/vignettes/) |
| [![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](http://hits.dwyl.io/IndrajeetPatil/ggstatsplot.svg)](http://hits.dwyl.io/IndrajeetPatil/ggstatsplot) | [![Last-changedate](https://img.shields.io/badge/last%20change-2019--12--18-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](http://hits.dwyl.io/IndrajeetPatil/ggstatsplot.svg)](http://hits.dwyl.io/IndrajeetPatil/ggstatsplot) | [![Last-changedate](https://img.shields.io/badge/last%20change-2019--12--20-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) | [![R build status](https://github.com/IndrajeetPatil/ggstatsplot/workflows/R-CMD-check/badge.svg)](https://github.com/IndrajeetPatil/ggstatsplot) | [![Gitter chat](https://badges.gitter.im/gitterHQ/gitter.png)](https://gitter.im/ggstatsplot/community) | [![Project Status](http://www.repostatus.org/badges/latest/active.svg)](http://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
Expand Down Expand Up @@ -217,7 +217,7 @@ ggstatsplot::ggplot_converter
#> function(plot) {
#> cowplot::ggdraw() + cowplot::draw_grob(grid::grobTree(plot))
#> }
#> <bytecode: 0x000000002d4a7830>
#> <bytecode: 0x000000002d953a70>
#> <environment: namespace:ggstatsplot>
```

Expand Down Expand Up @@ -437,9 +437,7 @@ ggstatsplot::ggwithinstats(
y = Taste,
sort = "descending", # ordering groups along the x-axis based on
sort.fun = median, # values of `y` variable
pairwise.comparisons = TRUE,
pairwise.display = "s",
pairwise.annotation = "p",
pairwise.comparisons = TRUE, # show pairwise comparison test results
title = "Wine tasting",
caption = "Data from: `WRS2` R package",
ggtheme = ggthemes::theme_fivethirtyeight(),
Expand Down
1 change: 1 addition & 0 deletions _pkgdown.yml
Expand Up @@ -65,4 +65,5 @@ reference:
- intent_morality
- iris_long
- VR_dilemma
- bugs_wide
- bugs_long
18 changes: 3 additions & 15 deletions codemeta.json
Expand Up @@ -14,7 +14,7 @@
],
"issueTracker": "https://github.com/IndrajeetPatil/ggstatsplot/issues",
"license": "https://spdx.org/licenses/GPL-3.0",
"version": "0.1.4",
"version": "0.1.4.9000",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "R",
Expand Down Expand Up @@ -87,18 +87,6 @@
},
"sameAs": "https://CRAN.R-project.org/package=broom.mixed"
},
{
"@type": "SoftwareApplication",
"identifier": "jmv",
"name": "jmv",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=jmv"
},
{
"@type": "SoftwareApplication",
"identifier": "knitr",
Expand Down Expand Up @@ -231,7 +219,7 @@
"@type": "SoftwareApplication",
"identifier": "broomExtra",
"name": "broomExtra",
"version": ">= 0.0.6",
"version": ">= 1.0.0",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
Expand Down Expand Up @@ -418,7 +406,7 @@
"@type": "SoftwareApplication",
"identifier": "pairwiseComparisons",
"name": "pairwiseComparisons",
"version": ">= 0.1.2",
"version": ">= 0.1.3",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
Expand Down
16 changes: 16 additions & 0 deletions data-raw/bugs_wide.R
@@ -0,0 +1,16 @@
# loading the needed libraries
library(jmv)
library(tibble)
library(tidyr)

# loading dataset
data("bugs", package = "jmv")

# converting to long format
bugs_wide <- tibble::as_tibble(bugs)

# all column names in lower case
names(bugs_wide) <- tolower(names(bugs_wide))

# saving the data
save(bugs_wide, file = "data/bugs_wide.rdata")
Binary file added data/bugs_wide.rdata
Binary file not shown.
5 changes: 1 addition & 4 deletions docs/404.html

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

0 comments on commit 3fa57fc

Please sign in to comment.