From 214b9a5bb8a7d58345e1f93e4e054c15d5e5cb84 Mon Sep 17 00:00:00 2001 From: Indrajeet Patil Date: Sun, 16 Apr 2023 11:59:38 +0200 Subject: [PATCH] Move afex and PMCMRplus to Imports (#241) * Move afex and PMCMRplus to Imports https://github.com/IndrajeetPatil/ggstatsplot/issues/837 * Apply automatic changes * minor * rstantools is needed * rstantools in suggests * fix lint --------- Co-authored-by: IndrajeetPatil --- CITATION.cff | 87 +++++++++++-------- DESCRIPTION | 5 +- NEWS.md | 5 ++ R/one_sample_test.R | 2 - R/oneway_anova.R | 8 +- R/pairwise_comparisons.R | 4 +- R/two_sample_test.R | 1 - codemeta.json | 86 ++++++++++-------- inst/WORDLIST | 12 +-- man/oneway_anova.Rd | 5 +- man/pairwise_comparisons.Rd | 3 +- man/tidy_model_parameters.Rd | 16 ++-- .../testthat/test-one_two_sample_dataframes.R | 2 - tests/testthat/test-oneway_anova_parametric.R | 4 - tests/testthat/test-pairwise_comparisons.R | 2 - vignettes/statsExpressions.Rmd | 5 +- vignettes/web_only/dataframe_outputs.Rmd | 1 - 17 files changed, 131 insertions(+), 117 deletions(-) diff --git a/CITATION.cff b/CITATION.cff index b0a0fada..1ad42b68 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -74,6 +74,28 @@ references: institution: name: R Foundation for Statistical Computing version: '>= 4.1.0' +- type: software + title: afex + abstract: 'afex: Analysis of Factorial Experiments' + notes: Imports + url: https://afex.singmann.science/ + repository: https://CRAN.R-project.org/package=afex + authors: + - family-names: Singmann + given-names: Henrik + email: singmann@gmail.com + orcid: https://orcid.org/0000-0002-4842-3657 + - family-names: Bolker + given-names: Ben + - family-names: Westfall + given-names: Jake + - family-names: Aust + given-names: Frederik + orcid: https://orcid.org/0000-0003-4900-788X + - family-names: Ben-Shachar + given-names: Mattan S. + year: '2023' + version: '>= 1.2-0' - type: software title: BayesFactor abstract: 'BayesFactor: Computation of Bayes Factors for Common Designs' @@ -340,6 +362,18 @@ references: orcid: https://orcid.org/0000-0001-9560-6336 year: '2023' version: '>= 0.10.2' +- type: software + title: PMCMRplus + abstract: 'PMCMRplus: Calculate Pairwise Multiple Comparisons of Mean Rank Sums + Extended' + notes: Imports + repository: https://CRAN.R-project.org/package=PMCMRplus + authors: + - family-names: Pohlert + given-names: Thorsten + email: thorsten.pohlert@gmx.de + orcid: https://orcid.org/0000-0003-3855-3025 + year: '2023' - type: software title: purrr abstract: 'purrr: Functional Programming Tools' @@ -463,28 +497,6 @@ references: given-names: Nathan email: nathanteetor@gmail.com year: '2023' -- type: software - title: afex - abstract: 'afex: Analysis of Factorial Experiments' - notes: Suggests - url: https://afex.singmann.science/ - repository: https://CRAN.R-project.org/package=afex - authors: - - family-names: Singmann - given-names: Henrik - email: singmann@gmail.com - orcid: https://orcid.org/0000-0002-4842-3657 - - family-names: Bolker - given-names: Ben - - family-names: Westfall - given-names: Jake - - family-names: Aust - given-names: Frederik - orcid: https://orcid.org/0000-0003-4900-788X - - family-names: Ben-Shachar - given-names: Mattan S. - year: '2023' - version: '>= 1.2-0' - type: software title: ggplot2 abstract: 'ggplot2: Create Elegant Data Visualisations Using the Grammar of Graphics' @@ -570,18 +582,6 @@ references: email: bolker@mcmaster.ca - name: R Development Core Team year: '2023' -- type: software - title: PMCMRplus - abstract: 'PMCMRplus: Calculate Pairwise Multiple Comparisons of Mean Rank Sums - Extended' - notes: Suggests - repository: https://CRAN.R-project.org/package=PMCMRplus - authors: - - family-names: Pohlert - given-names: Thorsten - email: thorsten.pohlert@gmx.de - orcid: https://orcid.org/0000-0003-3855-3025 - year: '2023' - type: software title: rmarkdown abstract: 'rmarkdown: Dynamic Documents for R' @@ -625,6 +625,25 @@ references: email: rich@posit.co orcid: https://orcid.org/0000-0003-3925-190X year: '2023' +- type: software + title: rstantools + abstract: 'rstantools: Tools for Developing R Packages Interfacing with ''Stan''' + notes: Suggests + url: https://mc-stan.org/rstantools/ + repository: https://CRAN.R-project.org/package=rstantools + authors: + - family-names: Gabry + given-names: Jonah + email: jsg2201@columbia.edu + - family-names: Goodrich + given-names: Ben + email: benjamin.goodrich@columbia.edu + - family-names: Lysy + given-names: Martin + email: mlysy@uwaterloo.ca + - family-names: Johnson + given-names: Andrew + year: '2023' - type: software title: survival abstract: 'survival: Survival Analysis' diff --git a/DESCRIPTION b/DESCRIPTION index 200bd178..858e5d76 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -25,6 +25,7 @@ BugReports: https://github.com/IndrajeetPatil/statsExpressions/issues Depends: R (>= 4.1.0) Imports: + afex (>= 1.2-0), BayesFactor (>= 0.9.12-4.4), correlation (>= 0.8.4), datawizard (>= 0.7.1), @@ -35,6 +36,7 @@ Imports: magrittr, parameters (>= 0.20.3), performance (>= 0.10.2), + PMCMRplus, purrr (>= 1.0.1), rlang, stats, @@ -44,14 +46,13 @@ Imports: WRS2 (>= 1.1-4), zeallot Suggests: - afex (>= 1.2-0), ggplot2, knitr, metaBMA, metafor, metaplus, - PMCMRplus, rmarkdown, + rstantools, survival, testthat (>= 3.1.7), utils diff --git a/NEWS.md b/NEWS.md index 9abe046c..ae3a1c41 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,10 @@ # statsExpressions 1.5.0.9000 +## MAJOR CHANGES + +- Following dependencies move from being weak to strong dependencies given their + importance in key functions: `{afex}` and `{PMCMRplus}`. + # statsExpressions 1.5.0 ## BREAKING CHANGES diff --git a/R/one_sample_test.R b/R/one_sample_test.R index d1c8b83d..f7949287 100644 --- a/R/one_sample_test.R +++ b/R/one_sample_test.R @@ -43,8 +43,6 @@ one_sample_test <- function(data, effsize.type = "g", ...) { type <- stats_type_switch(type) - - # preparing the vector x_vec <- stats::na.omit(data %>% pull({{ x }})) # parametric --------------------------------------- diff --git a/R/oneway_anova.R b/R/oneway_anova.R index 2d80406c..85c140ee 100644 --- a/R/oneway_anova.R +++ b/R/oneway_anova.R @@ -41,11 +41,10 @@ #' @param ... Additional arguments (currently ignored). #' @inheritParams stats::oneway.test #' -#' @examplesIf identical(Sys.getenv("NOT_CRAN"), "true") && requireNamespace("afex", quietly = TRUE) +#' @examplesIf identical(Sys.getenv("NOT_CRAN"), "true") #' # for reproducibility #' set.seed(123) #' library(statsExpressions) -#' suppressPackageStartupMessages(library(afex)) # for within-subjects parametric ANOVA #' #' # ----------------------- parametric ------------------------------------- #' @@ -105,6 +104,8 @@ #' type = "r" #' ) #' +#' @examplesIf identical(Sys.getenv("NOT_CRAN"), "true") && requireNamespace("rstantools", quietly = TRUE) +#' #' # ----------------------- Bayesian ------------------------------------- #' #' # between-subjects @@ -140,7 +141,6 @@ oneway_anova <- function(data, nboot = 100L, ...) { type <- stats_type_switch(type) - c(x, y) %<-% c(ensym(x), ensym(y)) data %<>% long_to_wide_converter( @@ -163,8 +163,6 @@ oneway_anova <- function(data, # styler: on if (paired) { - check_if_installed("afex", minimum_version = "1.0-0") - mod <- afex::aov_ez( id = ".rowid", dv = as_string(y), diff --git a/R/pairwise_comparisons.R b/R/pairwise_comparisons.R index a04cfe7e..a7a1c399 100644 --- a/R/pairwise_comparisons.R +++ b/R/pairwise_comparisons.R @@ -32,11 +32,10 @@ #' @references For more, see: #' #' -#' @examplesIf identical(Sys.getenv("NOT_CRAN"), "true") && requireNamespace("PMCMRplus", quietly = TRUE) +#' @examplesIf identical(Sys.getenv("NOT_CRAN"), "true") #' # for reproducibility #' set.seed(123) #' library(statsExpressions) -#' library(PMCMRplus) #' #' #------------------- between-subjects design ---------------------------- #' @@ -149,7 +148,6 @@ pairwise_comparisons <- function(data, p.adjust.method = "holm", k = 2L, ...) { - if (type != "robust") check_if_installed("PMCMRplus", reason = "for pairwise comparisons") type <- stats_type_switch(type) c(x, y) %<-% c(ensym(x), ensym(y)) diff --git a/R/two_sample_test.R b/R/two_sample_test.R index a94e3531..531cf4c8 100644 --- a/R/two_sample_test.R +++ b/R/two_sample_test.R @@ -125,7 +125,6 @@ two_sample_test <- function(data, nboot = 100L, ...) { type <- stats_type_switch(type) - c(x, y) %<-% c(ensym(x), ensym(y)) data %<>% long_to_wide_converter( diff --git a/codemeta.json b/codemeta.json index 3a8bd3aa..c263947f 100644 --- a/codemeta.json +++ b/codemeta.json @@ -49,19 +49,6 @@ } ], "softwareSuggestions": [ - { - "@type": "SoftwareApplication", - "identifier": "afex", - "name": "afex", - "version": ">= 1.2-0", - "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=afex" - }, { "@type": "SoftwareApplication", "identifier": "ggplot2", @@ -124,27 +111,27 @@ }, { "@type": "SoftwareApplication", - "identifier": "PMCMRplus", - "name": "PMCMRplus", + "identifier": "rmarkdown", + "name": "rmarkdown", "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=PMCMRplus" + "sameAs": "https://CRAN.R-project.org/package=rmarkdown" }, { "@type": "SoftwareApplication", - "identifier": "rmarkdown", - "name": "rmarkdown", + "identifier": "rstantools", + "name": "rstantools", "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=rmarkdown" + "sameAs": "https://CRAN.R-project.org/package=rstantools" }, { "@type": "SoftwareApplication", @@ -185,6 +172,19 @@ "version": ">= 4.1.0" }, "2": { + "@type": "SoftwareApplication", + "identifier": "afex", + "name": "afex", + "version": ">= 1.2-0", + "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=afex" + }, + "3": { "@type": "SoftwareApplication", "identifier": "BayesFactor", "name": "BayesFactor", @@ -197,7 +197,7 @@ }, "sameAs": "https://CRAN.R-project.org/package=BayesFactor" }, - "3": { + "4": { "@type": "SoftwareApplication", "identifier": "correlation", "name": "correlation", @@ -210,7 +210,7 @@ }, "sameAs": "https://CRAN.R-project.org/package=correlation" }, - "4": { + "5": { "@type": "SoftwareApplication", "identifier": "datawizard", "name": "datawizard", @@ -223,7 +223,7 @@ }, "sameAs": "https://CRAN.R-project.org/package=datawizard" }, - "5": { + "6": { "@type": "SoftwareApplication", "identifier": "dplyr", "name": "dplyr", @@ -236,7 +236,7 @@ }, "sameAs": "https://CRAN.R-project.org/package=dplyr" }, - "6": { + "7": { "@type": "SoftwareApplication", "identifier": "effectsize", "name": "effectsize", @@ -249,7 +249,7 @@ }, "sameAs": "https://CRAN.R-project.org/package=effectsize" }, - "7": { + "8": { "@type": "SoftwareApplication", "identifier": "glue", "name": "glue", @@ -261,7 +261,7 @@ }, "sameAs": "https://CRAN.R-project.org/package=glue" }, - "8": { + "9": { "@type": "SoftwareApplication", "identifier": "insight", "name": "insight", @@ -274,7 +274,7 @@ }, "sameAs": "https://CRAN.R-project.org/package=insight" }, - "9": { + "10": { "@type": "SoftwareApplication", "identifier": "magrittr", "name": "magrittr", @@ -286,7 +286,7 @@ }, "sameAs": "https://CRAN.R-project.org/package=magrittr" }, - "10": { + "11": { "@type": "SoftwareApplication", "identifier": "parameters", "name": "parameters", @@ -299,7 +299,7 @@ }, "sameAs": "https://CRAN.R-project.org/package=parameters" }, - "11": { + "12": { "@type": "SoftwareApplication", "identifier": "performance", "name": "performance", @@ -312,7 +312,19 @@ }, "sameAs": "https://CRAN.R-project.org/package=performance" }, - "12": { + "13": { + "@type": "SoftwareApplication", + "identifier": "PMCMRplus", + "name": "PMCMRplus", + "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=PMCMRplus" + }, + "14": { "@type": "SoftwareApplication", "identifier": "purrr", "name": "purrr", @@ -325,7 +337,7 @@ }, "sameAs": "https://CRAN.R-project.org/package=purrr" }, - "13": { + "15": { "@type": "SoftwareApplication", "identifier": "rlang", "name": "rlang", @@ -337,12 +349,12 @@ }, "sameAs": "https://CRAN.R-project.org/package=rlang" }, - "14": { + "16": { "@type": "SoftwareApplication", "identifier": "stats", "name": "stats" }, - "15": { + "17": { "@type": "SoftwareApplication", "identifier": "tibble", "name": "tibble", @@ -355,7 +367,7 @@ }, "sameAs": "https://CRAN.R-project.org/package=tibble" }, - "16": { + "18": { "@type": "SoftwareApplication", "identifier": "tidyr", "name": "tidyr", @@ -367,7 +379,7 @@ }, "sameAs": "https://CRAN.R-project.org/package=tidyr" }, - "17": { + "19": { "@type": "SoftwareApplication", "identifier": "withr", "name": "withr", @@ -379,7 +391,7 @@ }, "sameAs": "https://CRAN.R-project.org/package=withr" }, - "18": { + "20": { "@type": "SoftwareApplication", "identifier": "WRS2", "name": "WRS2", @@ -392,7 +404,7 @@ }, "sameAs": "https://CRAN.R-project.org/package=WRS2" }, - "19": { + "21": { "@type": "SoftwareApplication", "identifier": "zeallot", "name": "zeallot", @@ -406,7 +418,7 @@ }, "SystemRequirements": null }, - "fileSize": "4132.503KB", + "fileSize": "4131.834KB", "citation": [ { "@type": "ScholarlyArticle", diff --git a/inst/WORDLIST b/inst/WORDLIST index 32cfcf39..90c80692 100644 --- a/inst/WORDLIST +++ b/inst/WORDLIST @@ -12,7 +12,6 @@ Durbin Gunel HFHD IMDB -IndrajeetPatil Iyad JOSS Keselman @@ -26,9 +25,9 @@ NumGenre ORCID Otterstetter Penfield +Rafi Rahwan Satterthwaite -WRS Welch Welch's Welch’s @@ -38,8 +37,6 @@ Yuen’s al anova anthropods -bayes -bayestestR biserial conf df @@ -50,11 +47,7 @@ effectsize et freighteningness ggstatsplot -github hexsticker -https -indrajeetpatil -io joss lifecycle mpaa @@ -62,12 +55,9 @@ noncentrality normals patilindrajeets pre -psyarxiv setosa sphericity -theoj tibble -tu ungrouped ungroups unparsed diff --git a/man/oneway_anova.Rd b/man/oneway_anova.Rd index 671b3c61..38cd6434 100644 --- a/man/oneway_anova.Rd +++ b/man/oneway_anova.Rd @@ -172,11 +172,10 @@ The table below provides summary about: } \examples{ -\dontshow{if (identical(Sys.getenv("NOT_CRAN"), "true") && requireNamespace("afex", quietly = TRUE)) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (identical(Sys.getenv("NOT_CRAN"), "true")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # for reproducibility set.seed(123) library(statsExpressions) -suppressPackageStartupMessages(library(afex)) # for within-subjects parametric ANOVA # ----------------------- parametric ------------------------------------- @@ -235,6 +234,8 @@ oneway_anova( paired = TRUE, type = "r" ) +\dontshow{\}) # examplesIf} +\dontshow{if (identical(Sys.getenv("NOT_CRAN"), "true") && requireNamespace("rstantools", quietly = TRUE)) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # ----------------------- Bayesian ------------------------------------- diff --git a/man/pairwise_comparisons.Rd b/man/pairwise_comparisons.Rd index 037d49c2..67b0333f 100644 --- a/man/pairwise_comparisons.Rd +++ b/man/pairwise_comparisons.Rd @@ -155,11 +155,10 @@ Not supported. } \examples{ -\dontshow{if (identical(Sys.getenv("NOT_CRAN"), "true") && requireNamespace("PMCMRplus", quietly = TRUE)) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (identical(Sys.getenv("NOT_CRAN"), "true")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # for reproducibility set.seed(123) library(statsExpressions) -library(PMCMRplus) #------------------- between-subjects design ---------------------------- diff --git a/man/tidy_model_parameters.Rd b/man/tidy_model_parameters.Rd index b8edfd34..087b9cc4 100644 --- a/man/tidy_model_parameters.Rd +++ b/man/tidy_model_parameters.Rd @@ -10,11 +10,17 @@ tidy_model_parameters(model, ...) \item{model}{Statistical Model.} \item{...}{Arguments passed to or from other methods. Non-documented -arguments are \code{digits}, \code{p_digits}, \code{ci_digits} and -\code{footer_digits} to set the number of digits for the output. -\code{group} can also be passed to the \code{print()} method. See details -in \code{\link[parameters:print.parameters_model]{print.parameters_model()}} and 'Examples' in -\code{\link[parameters:model_parameters.default]{model_parameters.default()}}.} +arguments are \code{digits}, \code{p_digits}, \code{ci_digits} and \code{footer_digits} to set +the number of digits for the output. If \code{s_value = TRUE}, the p-value will +be replaced by the S-value in the output (cf. \emph{Rafi and Greenland 2020}). +\code{pd} adds an additional column with the \emph{probability of direction} (see +\code{\link[bayestestR:p_direction]{bayestestR::p_direction()}} for details). \code{groups} can be used to group +coefficients. It will be passed to the print-method, or can directly be used +in \code{print()}, see documentation in \code{\link[parameters:print.parameters_model]{print.parameters_model()}}. Furthermore, +see 'Examples' in \code{\link[parameters:model_parameters.default]{model_parameters.default()}}. For developers, whose +interest mainly is to get a "tidy" data frame of model summaries, it is +recommended to set \code{pretty_names = FALSE} to speed up computation of the +summary table.} } \description{ Convert \code{{parameters}} package output to \code{{tidyverse}} conventions diff --git a/tests/testthat/test-one_two_sample_dataframes.R b/tests/testthat/test-one_two_sample_dataframes.R index 3e6d0eab..fdc13107 100644 --- a/tests/testthat/test-one_two_sample_dataframes.R +++ b/tests/testthat/test-one_two_sample_dataframes.R @@ -1,5 +1,3 @@ -skip_if_not_installed("afex") - test_that( desc = " parametric t-tests", code = { diff --git a/tests/testthat/test-oneway_anova_parametric.R b/tests/testthat/test-oneway_anova_parametric.R index a3251d6c..3905173f 100644 --- a/tests/testthat/test-oneway_anova_parametric.R +++ b/tests/testthat/test-oneway_anova_parametric.R @@ -59,8 +59,6 @@ test_that( test_that( desc = "paired parametric anova subtitles work (without NAs)", code = { - skip_if_not_installed("afex") - # parametric repeated anova subtitles (basic) ---------------------------- # statsExpression output @@ -85,8 +83,6 @@ test_that( test_that( desc = "works with subject id", code = { - skip_if_not_installed("afex") - df <- data_with_subid diff --git a/tests/testthat/test-pairwise_comparisons.R b/tests/testthat/test-pairwise_comparisons.R index 94720eed..4870edbc 100644 --- a/tests/testthat/test-pairwise_comparisons.R +++ b/tests/testthat/test-pairwise_comparisons.R @@ -1,5 +1,3 @@ -skip_if_not_installed("PMCMRplus") - # between-subjects design -------------------------------------------------- test_that( diff --git a/vignettes/statsExpressions.Rmd b/vignettes/statsExpressions.Rmd index 7e9a1b41..8fd5b39e 100644 --- a/vignettes/statsExpressions.Rmd +++ b/vignettes/statsExpressions.Rmd @@ -23,10 +23,7 @@ vignette: > #| echo = FALSE source("setup.R") -pkgs <- c( - "afex", - "ggplot2" -) +pkgs <- "ggplot2" successfully_loaded <- purrr::map_lgl(pkgs, requireNamespace, quietly = TRUE) can_evaluate <- all(successfully_loaded) diff --git a/vignettes/web_only/dataframe_outputs.Rmd b/vignettes/web_only/dataframe_outputs.Rmd index 765739bc..ea83d526 100644 --- a/vignettes/web_only/dataframe_outputs.Rmd +++ b/vignettes/web_only/dataframe_outputs.Rmd @@ -21,7 +21,6 @@ vignette: > source("../setup.R") pkgs <- c( - "afex", "ggplot2", "metaplus" )