diff --git a/CITATION.cff b/CITATION.cff index a06f5d6c..27d496b4 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -8,7 +8,7 @@ message: 'To cite package "statsExpressions" in publications use:' type: software license: GPL-3.0-only title: 'statsExpressions: Tidy Dataframes and Expressions with Statistical Details' -version: 1.5.1.9000 +version: 1.5.2 doi: 10.21105/joss.03236 abstract: 'Utilities for producing dataframes with rich details for the most common types of statistical approaches and tests: parametric, nonparametric, robust, and @@ -116,7 +116,7 @@ references: abstract: 'correlation: Methods for Correlation Analysis' notes: Imports url: https://easystats.github.io/correlation/ - repository: https://CRAN.R-project.org/package=correlation + repository: https://easystats.r-universe.dev authors: - family-names: Makowski given-names: Dominique @@ -138,8 +138,12 @@ references: given-names: Mattan S. email: matanshm@post.bgu.ac.il orcid: https://orcid.org/0000-0002-4287-4801 + - family-names: Thériault + given-names: Rémi + email: remi.theriault@mail.mcgill.ca + orcid: https://orcid.org/0000-0003-4315-6788 year: '2023' - version: '>= 0.8.4' + version: '>= 0.8.5' - type: software title: datawizard abstract: 'datawizard: Easy Data Wrangling and Statistical Transformations' @@ -197,7 +201,7 @@ references: email: davis@posit.co orcid: https://orcid.org/0000-0003-4777-038X year: '2023' - version: '>= 1.1.2' + version: '>= 1.1.3' - type: software title: effectsize abstract: 'effectsize: Indices of Effect Size' @@ -286,7 +290,7 @@ references: email: etienne.bacher@protonmail.com orcid: https://orcid.org/0000-0002-9271-5075 year: '2023' - version: '>= 0.19.3' + version: '>= 0.19.4' - type: software title: magrittr abstract: 'magrittr: A Forward-Pipe Operator for R' @@ -365,7 +369,7 @@ references: email: brenton@wiernik.org orcid: https://orcid.org/0000-0001-9560-6336 year: '2023' - version: '>= 0.10.3' + version: '>= 0.10.4' - type: software title: PMCMRplus abstract: 'PMCMRplus: Calculate Pairwise Multiple Comparisons of Mean Rank Sums diff --git a/DESCRIPTION b/DESCRIPTION index da17048e..044178e6 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -27,15 +27,15 @@ Depends: Imports: afex (>= 1.3-0), BayesFactor (>= 0.9.12-4.4), - correlation (>= 0.8.4), + correlation (>= 0.8.5), datawizard (>= 0.8.0), - dplyr (>= 1.1.2), + dplyr (>= 1.1.3), effectsize (>= 0.8.5), glue, - insight (>= 0.19.3), + insight (>= 0.19.4), magrittr, parameters (>= 0.21.1), - performance (>= 0.10.3), + performance (>= 0.10.4), PMCMRplus (>= 1.9.7), purrr (>= 1.0.2), rlang, diff --git a/R/add_expression_col.R b/R/add_expression_col.R index 060e33a7..1311f787 100644 --- a/R/add_expression_col.R +++ b/R/add_expression_col.R @@ -97,7 +97,7 @@ add_expression_col <- function(data, no.parameters <- sum("df.error" %in% names(data) + "df" %in% names(data)) # special case for Bayesian contingency table analysis - if (bayesian && grepl("contingency", data$method[[1]], fixed = TRUE)) data %<>% mutate(effectsize = "Cramers_v") + if (bayesian && grepl("contingency", data$method[[1L]], fixed = TRUE)) data %<>% mutate(effectsize = "Cramers_v") # convert needed columns to character type df_expr <- .data_to_char(data, k, k.df, k.df.error) @@ -169,7 +169,7 @@ add_expression_col <- function(data, across(.fns = ~ .to_char(.x, k), .cols = matches("^est|^sta|p.value|.scale$|.low$|.high$|^log")), across(.fns = ~ .to_char(.x, k.df), .cols = matches("^df$")), across(.fns = ~ .to_char(.x, k.df.error), .cols = matches("^df.error$")), - across(.fns = ~ paste0(.x * 100, "%"), .cols = matches("^conf.level$")) + across(.fns = ~ paste0(.x * 100L, "%"), .cols = matches("^conf.level$")) ) } diff --git a/R/contingency_table.R b/R/contingency_table.R index 3c2bf600..991bd945 100644 --- a/R/contingency_table.R +++ b/R/contingency_table.R @@ -101,7 +101,7 @@ contingency_table <- function(data, conf.level = 0.95, sampling.plan = "indepMulti", fixed.margin = "rows", - prior.concentration = 1, + prior.concentration = 1.0, ...) { type <- stats_type_switch(type) test <- ifelse(quo_is_null(enquo(y)), "1way", "2way") @@ -163,7 +163,7 @@ contingency_table <- function(data, } p1s <- rdirichlet(n = 100000L, alpha = prior.concentration * ratio) - pr_h1 <- map_dbl(1:100000, ~ stats::dmultinom(as.matrix(xtab), prob = p1s[.x, ], log = TRUE)) + pr_h1 <- map_dbl(1:100000L, ~ stats::dmultinom(as.matrix(xtab), prob = p1s[.x, ], log = TRUE)) # BF = (log) prob of data under alternative - (log) prob of data under null # computing Bayes Factor and formatting the results diff --git a/R/meta_analysis.R b/R/meta_analysis.R index 4ea9e0ab..498c544b 100644 --- a/R/meta_analysis.R +++ b/R/meta_analysis.R @@ -41,38 +41,21 @@ #' set.seed(123) #' library(statsExpressions) #' -#' # a data frame with estimates and standard errors -#' # (`mag` dataset from `{metaplus}`) -#' df <- tibble::tribble( -#' ~study, ~estimate, ~std.error, -#' "Abraham", -0.83, 1.247, -#' "Bertschat", -1.056, 0.414, -#' "Ceremuzynski", -1.278, 0.808, -#' "Feldstedt", -0.043, 1.429, -#' "Golf", 0.223, 0.489, -#' "ISIS-4", -2.407, 1.072, -#' "LIMIT-2", -1.28, 1.193, -#' "Morton", -1.191, 1.661, -#' "Pereira", -0.695, 0.536, -#' "Rasmussen", -2.208, 1.109, -#' "Schechter", -2.038, 0.78, -#' "Schechter 1", -0.85, 0.618, -#' "Schechter 2", -0.793, 0.625, -#' "Singh", -0.299, 0.146, -#' "Smith", -1.57, 0.574, -#' "Thogersen", 0.057, 0.031 -#' ) +#' @examplesIf requireNamespace("metaplus", quietly = TRUE) +#' # let's use `mag` dataset from `{metaplus}` +#' data(mag, package = "metaplus") +#' dat <- dplyr::rename(mag, estimate = yi, std.error = sei) #' #' # parametric -#' meta_analysis(df) +#' meta_analysis(dat) #' #' @examplesIf identical(Sys.getenv("NOT_CRAN"), "true") && requireNamespace("metaplus", quietly = TRUE) #' # robust -#' meta_analysis(df, type = "random", random = "normal") +#' meta_analysis(dat, type = "random", random = "normal") #' #' @examplesIf identical(Sys.getenv("NOT_CRAN"), "true") && requireNamespace("metaBMA", quietly = TRUE) #' # Bayesian -#' meta_analysis(df, type = "bayes") +#' meta_analysis(dat, type = "bayes") #' #' @export meta_analysis <- function(data, diff --git a/R/oneway_anova.R b/R/oneway_anova.R index 48e38ec3..fdba82a4 100644 --- a/R/oneway_anova.R +++ b/R/oneway_anova.R @@ -155,7 +155,7 @@ oneway_anova <- function(data, # parametric --------------------------------------- if (type == "parametric") { - c(k.df, k.df.error) %<-% c(ifelse(!paired, 0L, k), ifelse(!paired && var.equal, 0L, k)) + c(k.df, k.df.error) %<-% c(ifelse(paired, k, 0L), ifelse(!paired && var.equal, 0L, k)) # styler: off if (effsize.type %in% c("unbiased", "omega")) .f.es <- effectsize::omega_squared diff --git a/codemeta.json b/codemeta.json index 4fb1b746..3b907906 100644 --- a/codemeta.json +++ b/codemeta.json @@ -8,7 +8,7 @@ "codeRepository": "https://github.com/IndrajeetPatil/statsExpressions", "issueTracker": "https://github.com/IndrajeetPatil/statsExpressions/issues", "license": "https://spdx.org/licenses/GPL-3.0", - "version": "1.5.1.9000", + "version": "1.5.2", "programmingLanguage": { "@type": "ComputerLanguage", "name": "R", @@ -213,7 +213,7 @@ "@type": "SoftwareApplication", "identifier": "correlation", "name": "correlation", - "version": ">= 0.8.4", + "version": ">= 0.8.5", "provider": { "@id": "https://cran.r-project.org", "@type": "Organization", @@ -239,7 +239,7 @@ "@type": "SoftwareApplication", "identifier": "dplyr", "name": "dplyr", - "version": ">= 1.1.2", + "version": ">= 1.1.3", "provider": { "@id": "https://cran.r-project.org", "@type": "Organization", @@ -277,7 +277,7 @@ "@type": "SoftwareApplication", "identifier": "insight", "name": "insight", - "version": ">= 0.19.3", + "version": ">= 0.19.4", "provider": { "@id": "https://cran.r-project.org", "@type": "Organization", @@ -315,7 +315,7 @@ "@type": "SoftwareApplication", "identifier": "performance", "name": "performance", - "version": ">= 0.10.3", + "version": ">= 0.10.4", "provider": { "@id": "https://cran.r-project.org", "@type": "Organization", @@ -431,7 +431,7 @@ }, "SystemRequirements": null }, - "fileSize": "4131.443KB", + "fileSize": "4130.563KB", "citation": [ { "@type": "ScholarlyArticle", diff --git a/man/meta_analysis.Rd b/man/meta_analysis.Rd index af449e2d..0a941a30 100644 --- a/man/meta_analysis.Rd +++ b/man/meta_analysis.Rd @@ -103,38 +103,21 @@ The table below provides summary about: # setup set.seed(123) library(statsExpressions) - -# a data frame with estimates and standard errors -# (`mag` dataset from `{metaplus}`) -df <- tibble::tribble( - ~study, ~estimate, ~std.error, - "Abraham", -0.83, 1.247, - "Bertschat", -1.056, 0.414, - "Ceremuzynski", -1.278, 0.808, - "Feldstedt", -0.043, 1.429, - "Golf", 0.223, 0.489, - "ISIS-4", -2.407, 1.072, - "LIMIT-2", -1.28, 1.193, - "Morton", -1.191, 1.661, - "Pereira", -0.695, 0.536, - "Rasmussen", -2.208, 1.109, - "Schechter", -2.038, 0.78, - "Schechter 1", -0.85, 0.618, - "Schechter 2", -0.793, 0.625, - "Singh", -0.299, 0.146, - "Smith", -1.57, 0.574, - "Thogersen", 0.057, 0.031 -) +\dontshow{\}) # examplesIf} +\dontshow{if (requireNamespace("metaplus", quietly = TRUE)) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +# let's use `mag` dataset from `{metaplus}` +data(mag, package = "metaplus") +dat <- dplyr::rename(mag, estimate = yi, std.error = sei) # parametric -meta_analysis(df) +meta_analysis(dat) \dontshow{\}) # examplesIf} \dontshow{if (identical(Sys.getenv("NOT_CRAN"), "true") && requireNamespace("metaplus", quietly = TRUE)) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # robust -meta_analysis(df, type = "random", random = "normal") +meta_analysis(dat, type = "random", random = "normal") \dontshow{\}) # examplesIf} \dontshow{if (identical(Sys.getenv("NOT_CRAN"), "true") && requireNamespace("metaBMA", quietly = TRUE)) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Bayesian -meta_analysis(df, type = "bayes") +meta_analysis(dat, type = "bayes") \dontshow{\}) # examplesIf} } diff --git a/man/reexports.Rd b/man/reexports.Rd index 19fb5063..67723495 100644 --- a/man/reexports.Rd +++ b/man/reexports.Rd @@ -16,7 +16,7 @@ These objects are imported from other packages. Follow the links below to see their documentation. \describe{ - \item{magrittr}{\code{\link[magrittr:compound]{\%<>\%}}, \code{\link[magrittr:pipe]{\%>\%}}, \code{\link[magrittr:exposition]{\%$\%}}} + \item{magrittr}{\code{\link[magrittr:exposition]{\%$\%}}, \code{\link[magrittr:compound]{\%<>\%}}, \code{\link[magrittr:pipe]{\%>\%}}} \item{tibble}{\code{\link[tibble]{as_tibble}}, \code{\link[tibble]{tibble}}} diff --git a/tests/testthat/test-meta_random_bayes.R b/tests/testthat/test-meta_random_bayes.R index e711abbb..4809cf81 100644 --- a/tests/testthat/test-meta_random_bayes.R +++ b/tests/testthat/test-meta_random_bayes.R @@ -2,8 +2,6 @@ # Bayesian meta-analysis often crashes R session on macOS # this makes sure this test will be run after all others - - test_that( desc = "meta_analysis works - bayesian", code = { @@ -11,7 +9,7 @@ test_that( skip_if_not_installed("metaplus") data(mag, package = "metaplus") - dat <- mag %>% rename(estimate = yi, std.error = sei) + dat <- dplyr::rename(mag, estimate = yi, std.error = sei) set.seed(123) df <- suppressWarnings(meta_analysis(