diff --git a/.Rbuildignore b/.Rbuildignore index fbf9447b..2ba9ea01 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -1,3 +1,4 @@ +.ls-lint.yml ^.*\.Rproj$ ^.gitlab-ci\.yaml$ ^API$ diff --git a/.github/workflows/R-CMD-check-devel.yaml b/.github/workflows/R-CMD-check-devel.yaml index c09a4a26..748e5858 100644 --- a/.github/workflows/R-CMD-check-devel.yaml +++ b/.github/workflows/R-CMD-check-devel.yaml @@ -20,11 +20,11 @@ jobs: - uses: r-lib/actions/setup-pandoc@v2 with: - pandoc-version: "3.1.7" + pandoc-version: "3.1.11.1" - uses: r-lib/actions/setup-r@v2 with: - r-version: "devel" + #r-version: "devel" http-user-agent: "release" use-public-rspm: true diff --git a/.github/workflows/R-CMD-check-hard.yaml b/.github/workflows/R-CMD-check-hard.yaml index c808e8dd..59fde76b 100644 --- a/.github/workflows/R-CMD-check-hard.yaml +++ b/.github/workflows/R-CMD-check-hard.yaml @@ -27,7 +27,7 @@ jobs: - uses: r-lib/actions/setup-pandoc@v2 with: - pandoc-version: "3.1.9" + pandoc-version: "3.1.11.1" - uses: r-lib/actions/setup-r@v2 with: diff --git a/.github/workflows/R-CMD-check-strict.yaml b/.github/workflows/R-CMD-check-strict.yaml index 53b0612d..72ae6a8f 100644 --- a/.github/workflows/R-CMD-check-strict.yaml +++ b/.github/workflows/R-CMD-check-strict.yaml @@ -40,7 +40,7 @@ jobs: - uses: r-lib/actions/setup-pandoc@v2 with: - pandoc-version: "3.1.9" + pandoc-version: "3.1.11.1" - uses: r-lib/actions/setup-r@v2 with: diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 89d24d53..68146fef 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -27,11 +27,11 @@ jobs: #- { os: windows-latest, r: "devel" } - { os: windows-latest, r: "release" } - - { os: windows-latest, r: "oldrel-1" } + #- { os: windows-latest, r: "oldrel-1" } #- { os: ubuntu-latest, r: "devel" } - { os: ubuntu-latest, r: "release" } - - { os: ubuntu-latest, r: "oldrel-1" } + #- { os: ubuntu-latest, r: "oldrel-1" } env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} @@ -42,7 +42,7 @@ jobs: - uses: r-lib/actions/setup-pandoc@v2 with: - pandoc-version: "3.1.9" + pandoc-version: "3.1.11.1" - uses: r-lib/actions/setup-r@v2 with: diff --git a/.github/workflows/check-all-examples.yaml b/.github/workflows/check-all-examples.yaml index 1abe1f71..fca9046d 100644 --- a/.github/workflows/check-all-examples.yaml +++ b/.github/workflows/check-all-examples.yaml @@ -30,7 +30,7 @@ jobs: - uses: r-lib/actions/setup-r@v2 with: - r-version: "devel" + #r-version: "devel" use-public-rspm: true - uses: r-lib/actions/setup-r-dependencies@v2 diff --git a/.github/workflows/check-link-rot.yaml b/.github/workflows/check-link-rot.yaml index f83c1889..0452beb6 100644 --- a/.github/workflows/check-link-rot.yaml +++ b/.github/workflows/check-link-rot.yaml @@ -21,11 +21,11 @@ jobs: - uses: r-lib/actions/setup-pandoc@v2 with: - pandoc-version: "3.1.9" + pandoc-version: "3.1.11.1" - uses: r-lib/actions/setup-r@v2 with: - r-version: "devel" + #r-version: "devel" use-public-rspm: true - uses: r-lib/actions/setup-r-dependencies@v2 diff --git a/.github/workflows/check-random-test-order.yaml b/.github/workflows/check-random-test-order.yaml index 06560a16..7fa7b831 100644 --- a/.github/workflows/check-random-test-order.yaml +++ b/.github/workflows/check-random-test-order.yaml @@ -18,7 +18,7 @@ jobs: - uses: r-lib/actions/setup-r@v2 with: - r-version: "devel" + #r-version: "devel" use-public-rspm: true - uses: r-lib/actions/setup-r-dependencies@v2 diff --git a/.github/workflows/check-readme.yaml b/.github/workflows/check-readme.yaml index 3aff87cf..359148b6 100644 --- a/.github/workflows/check-readme.yaml +++ b/.github/workflows/check-readme.yaml @@ -30,7 +30,7 @@ jobs: - uses: r-lib/actions/setup-pandoc@v2 with: - pandoc-version: "3.1.7" + pandoc-version: "3.1.11.1" - uses: r-lib/actions/setup-r@v2 with: diff --git a/.github/workflows/check-spelling.yaml b/.github/workflows/check-spelling.yaml index 9f2bd1ee..843015ec 100644 --- a/.github/workflows/check-spelling.yaml +++ b/.github/workflows/check-spelling.yaml @@ -21,7 +21,7 @@ jobs: - uses: r-lib/actions/setup-pandoc@v2 with: - pandoc-version: "3.1.9" + pandoc-version: "3.1.11.1" - uses: r-lib/actions/setup-r@v2 with: diff --git a/.github/workflows/check-test-warnings.yaml b/.github/workflows/check-test-warnings.yaml index b5e86476..28a2ceb5 100644 --- a/.github/workflows/check-test-warnings.yaml +++ b/.github/workflows/check-test-warnings.yaml @@ -22,7 +22,7 @@ jobs: - uses: r-lib/actions/setup-r@v2 with: - r-version: "devel" + #r-version: "devel" use-public-rspm: true - uses: r-lib/actions/setup-r-dependencies@v2 diff --git a/.github/workflows/check-vignette-warnings.yaml b/.github/workflows/check-vignette-warnings.yaml index b7a3711f..630bcad8 100644 --- a/.github/workflows/check-vignette-warnings.yaml +++ b/.github/workflows/check-vignette-warnings.yaml @@ -22,11 +22,11 @@ jobs: - uses: r-lib/actions/setup-pandoc@v2 with: - pandoc-version: "3.1.7" + pandoc-version: "3.1.11.1" - uses: r-lib/actions/setup-r@v2 with: - r-version: "devel" + #r-version: "devel" use-public-rspm: true - uses: r-lib/actions/setup-r-dependencies@v2 diff --git a/.github/workflows/html-5-check.yaml b/.github/workflows/html-5-check.yaml index 8dc89709..c1a781e9 100644 --- a/.github/workflows/html-5-check.yaml +++ b/.github/workflows/html-5-check.yaml @@ -19,7 +19,7 @@ jobs: - uses: r-lib/actions/setup-r@v2 with: - r-version: "devel" + #r-version: "devel" use-public-rspm: true - uses: r-lib/actions/setup-r-dependencies@v2 diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 5a137fdd..42552dfd 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -38,7 +38,8 @@ jobs: run: | options(crayon.enabled = TRUE) library(lintr) - lint_package(linters = linters_with_defaults( + lint_package(linters = linters_with_tags( + tags = NULL, absolute_path_linter = NULL, assignment_linter = NULL, commented_code_linter = NULL, @@ -59,8 +60,7 @@ jobs: undesirable_function_linter = NULL, undesirable_operator_linter = NULL, unnecessary_concatenation_linter(allow_single_expression = FALSE), - unused_import_linter = NULL, - defaults = linters_with_tags(tags = NULL) + unused_import_linter = NULL )) shell: Rscript {0} env: diff --git a/.github/workflows/pkgdown-no-suggests.yaml b/.github/workflows/pkgdown-no-suggests.yaml index 3124977d..ed331237 100644 --- a/.github/workflows/pkgdown-no-suggests.yaml +++ b/.github/workflows/pkgdown-no-suggests.yaml @@ -25,7 +25,7 @@ jobs: - uses: r-lib/actions/setup-pandoc@v2 with: - pandoc-version: "3.1.9" + pandoc-version: "3.1.11.1" - uses: r-lib/actions/setup-r@v2 with: diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml index a676b429..9a5442a0 100644 --- a/.github/workflows/pkgdown.yaml +++ b/.github/workflows/pkgdown.yaml @@ -24,7 +24,7 @@ jobs: - uses: r-lib/actions/setup-pandoc@v2 with: - pandoc-version: "3.1.7" + pandoc-version: "3.1.11.1" - uses: r-lib/actions/setup-r@v2 with: @@ -46,7 +46,7 @@ jobs: - name: Deploy to GitHub pages 🚀 if: github.event_name != 'pull_request' - uses: JamesIves/github-pages-deploy-action@v4.4.3 + uses: JamesIves/github-pages-deploy-action@v4.5.0 with: branch: gh-pages folder: docs diff --git a/.github/workflows/pre-commit.yaml b/.github/workflows/pre-commit.yaml index 00c43673..97b4e39e 100644 --- a/.github/workflows/pre-commit.yaml +++ b/.github/workflows/pre-commit.yaml @@ -24,7 +24,7 @@ jobs: fetch-depth: 0 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: "3.9" architecture: "x64" diff --git a/.github/workflows/styler.yaml b/.github/workflows/styler.yaml index 2560236a..15b95ad3 100644 --- a/.github/workflows/styler.yaml +++ b/.github/workflows/styler.yaml @@ -29,7 +29,7 @@ jobs: local::. r-lib/pkgapi r-lib/styler - r-lib/roxygen2 + any::roxygen2 anthonynorth/roxyglobals needs: | styler diff --git a/.lintr b/.lintr index 843f5e62..a7324e54 100644 --- a/.lintr +++ b/.lintr @@ -1,9 +1,8 @@ -linters: linters_with_defaults( +linters: all_linters( absolute_path_linter = NULL, assignment_linter = NULL, commented_code_linter = NULL, cyclocomp_linter(25L), - extraction_operator_linter = NULL, if_not_else_linter(exceptions = character(0L)), implicit_integer_linter = NULL, library_call_linter = NULL, @@ -19,6 +18,5 @@ linters: linters_with_defaults( undesirable_function_linter = NULL, undesirable_operator_linter = NULL, unnecessary_concatenation_linter(allow_single_expression = FALSE), - unused_import_linter = NULL, - defaults = linters_with_tags(tags = NULL) + unused_import_linter = NULL ) diff --git a/.ls-lint.yml b/.ls-lint.yml new file mode 100644 index 00000000..fd1e3dd6 --- /dev/null +++ b/.ls-lint.yml @@ -0,0 +1,6 @@ +ls: + .R: kebab-case + +# package name can't be changed to follow kebab-case +ignore: + - '**/statsExpressions*' diff --git a/CITATION.cff b/CITATION.cff index 680818a9..f68e3a67 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -110,7 +110,7 @@ references: given-names: Jeffrey N. email: jrouder@uci.edu year: '2023' - version: '>= 0.9.12-4.5' + version: '>= 0.9.12-4.6' - type: software title: correlation abstract: 'correlation: Methods for Correlation Analysis' @@ -201,7 +201,7 @@ references: email: davis@posit.co orcid: https://orcid.org/0000-0003-4777-038X year: '2023' - version: '>= 1.1.3' + version: '>= 1.1.4' - type: software title: effectsize abstract: 'effectsize: Indices of Effect Size' @@ -255,7 +255,7 @@ references: abstract: 'insight: Easy Access to Model Information for Various Model Objects' notes: Imports url: https://easystats.github.io/insight/ - repository: https://easystats.r-universe.dev + repository: https://CRAN.R-project.org/package=insight authors: - family-names: Lüdecke given-names: Daniel @@ -290,7 +290,7 @@ references: email: etienne.bacher@protonmail.com orcid: https://orcid.org/0000-0002-9271-5075 year: '2023' - version: '>= 0.19.6' + version: '>= 0.19.7' - type: software title: magrittr abstract: 'magrittr: A Forward-Pipe Operator for R' @@ -336,13 +336,13 @@ references: email: brenton@wiernik.org orcid: https://orcid.org/0000-0001-9560-6336 year: '2023' - version: '>= 0.21.2' + version: '>= 0.21.3' - type: software title: performance abstract: 'performance: Assessment of Regression Models Performance' notes: Imports url: https://easystats.github.io/performance/ - repository: https://CRAN.R-project.org/package=performance + repository: https://easystats.r-universe.dev authors: - family-names: Lüdecke given-names: Daniel @@ -537,6 +537,7 @@ references: email: brenton@wiernik.org orcid: https://orcid.org/0000-0001-9560-6336 year: '2023' + version: '>= 0.13.1' - type: software title: ggplot2 abstract: 'ggplot2: Create Elegant Data Visualisations Using the Grammar of Graphics' @@ -706,7 +707,7 @@ references: given-names: Hadley email: hadley@posit.co year: '2023' - version: '>= 3.2.0' + version: '>= 3.2.1' - type: software title: utils abstract: 'R: A Language and Environment for Statistical Computing' diff --git a/DESCRIPTION b/DESCRIPTION index 08814454..6a29b8da 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -26,15 +26,15 @@ Depends: R (>= 4.1.0) Imports: afex (>= 1.3-0), - BayesFactor (>= 0.9.12-4.5), + BayesFactor (>= 0.9.12-4.6), correlation (>= 0.8.4), datawizard (>= 0.9.0), - dplyr (>= 1.1.3), + dplyr (>= 1.1.4), effectsize (>= 0.8.6), glue, - insight (>= 0.19.6), + insight (>= 0.19.7), magrittr, - parameters (>= 0.21.2), + parameters (>= 0.21.3), performance (>= 0.10.8), PMCMRplus, purrr (>= 1.0.2), @@ -46,7 +46,7 @@ Imports: WRS2, zeallot Suggests: - bayestestR, + bayestestR (>= 0.13.1), ggplot2, knitr, metaBMA, @@ -55,7 +55,7 @@ Suggests: rmarkdown, rstantools, survival, - testthat (>= 3.2.0), + testthat (>= 3.2.1), utils VignetteBuilder: knitr @@ -66,7 +66,7 @@ Roxygen: list( markdown = TRUE, roclets = c("collate", "namespace", "rd", "pkgapi::api_roclet", "roxyglobals::global_roclet") ) -RoxygenNote: 7.2.3.9000 +RoxygenNote: 7.3.0 Config/testthat/edition: 3 Config/testthat/parallel: true Config/Needs/check: anthonynorth/roxyglobals diff --git a/R/add_expression_col.R b/R/add-expression-col.R similarity index 84% rename from R/add_expression_col.R rename to R/add-expression-col.R index 72d0b452..ee1ed3ca 100644 --- a/R/add_expression_col.R +++ b/R/add-expression-col.R @@ -76,21 +76,22 @@ #' k.df = 3L #' ) #' @export -add_expression_col <- function(data, - paired = FALSE, - statistic.text = NULL, - effsize.text = NULL, - prior.type = NULL, - n = NULL, - n.text = ifelse( - paired, - list(quote(italic("n")["pairs"])), - list(quote(italic("n")["obs"])) - ), - k = 2L, - k.df = 0L, - k.df.error = k.df, - ...) { +add_expression_col <- function( + data, + paired = FALSE, + statistic.text = NULL, + effsize.text = NULL, + prior.type = NULL, + n = NULL, + n.text = ifelse( + paired, + list(quote(italic("n")["pairs"])), + list(quote(italic("n")["obs"])) + ), + k = 2L, + k.df = 0L, + k.df.error = k.df, + ...) { if (!"n.obs" %in% colnames(data)) data %<>% mutate(n.obs = n) if (!"effectsize" %in% colnames(data)) data %<>% mutate(effectsize = method) data %<>% rename_with(recode, bayes.factor = "bf10") @@ -101,15 +102,14 @@ add_expression_col <- function(data, # special case for Bayesian contingency table analysis 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) - - df_expr %<>% mutate( - statistic.text = statistic.text %||% stat_text_switch(tolower(method)), - es.text = effsize.text %||% estimate_type_switch(tolower(effectsize)), - prior.distribution = prior_switch(tolower(method)), - n.obs = .prettyNum(n.obs) - ) + df_expr <- data %>% # convert needed columns to character type + .data_to_char(k, k.df, k.df.error) %>% + mutate( + statistic.text = statistic.text %||% stat_text_switch(tolower(method)), + es.text = effsize.text %||% estimate_type_switch(tolower(effectsize)), + prior.distribution = prior_switch(tolower(method)), + n.obs = .prettyNum(n.obs) + ) # Bayesian analysis ------------------------------ @@ -133,8 +133,7 @@ add_expression_col <- function(data, # 1 degree of freedom -------------------- if (!bayesian && no.parameters == 1L) { - # for chi-squared statistic - if ("df" %in% colnames(df_expr)) df_expr %<>% mutate(df.error = df) + if ("df" %in% colnames(df_expr)) df_expr %<>% mutate(df.error = df) # for chi-squared statistic df_expr %<>% mutate(expression = glue("list( {statistic.text}*'('*{df.error}*')'=='{statistic}', italic(p)=='{p.value}', diff --git a/R/centrality_description.R b/R/centrality-description.R similarity index 81% rename from R/centrality_description.R rename to R/centrality-description.R index 9dc9f553..d2734179 100644 --- a/R/centrality_description.R +++ b/R/centrality-description.R @@ -26,16 +26,17 @@ #' #' @autoglobal #' -#' @example man/examples/examples-centrality_description.R +#' @example man/examples/examples-centrality-description.R #' @export -centrality_description <- function(data, - x, - y, - type = "parametric", - conf.level = NULL, - tr = 0.2, - k = 2L, - ...) { +centrality_description <- function( + data, + x, + y, + type = "parametric", + conf.level = NULL, + tr = 0.2, + k = 2L, + ...) { # styler: off centrality <- case_match( diff --git a/R/contingency_table.R b/R/contingency-table.R similarity index 91% rename from R/contingency_table.R rename to R/contingency-table.R index 22debc7d..b8db5bd0 100644 --- a/R/contingency_table.R +++ b/R/contingency-table.R @@ -92,19 +92,22 @@ #' type = "bayes" #' ) #' @export -contingency_table <- function(data, - x, - y = NULL, - paired = FALSE, - type = "parametric", - counts = NULL, - ratio = NULL, - k = 2L, - conf.level = 0.95, - sampling.plan = "indepMulti", - fixed.margin = "rows", - prior.concentration = 1.0, - ...) { +contingency_table <- function( + data, + x, + y = NULL, + paired = FALSE, + type = "parametric", + counts = NULL, + ratio = NULL, + k = 2L, + conf.level = 0.95, + sampling.plan = "indepMulti", + fixed.margin = "rows", + prior.concentration = 1.0, + ...) { + # data ------------------------------------------- + type <- stats_type_switch(type) test <- ifelse(quo_is_null(enquo(y)), "1way", "2way") diff --git a/R/corr_test.R b/R/corr-test.R similarity index 78% rename from R/corr_test.R rename to R/corr-test.R index 1ada7528..3d651bd7 100644 --- a/R/corr_test.R +++ b/R/corr-test.R @@ -25,17 +25,18 @@ #' #' @autoglobal #' -#' @example man/examples/examples-corr_test.R +#' @example man/examples/examples-corr-test.R #' @export -corr_test <- function(data, - x, - y, - type = "parametric", - k = 2L, - conf.level = 0.95, - tr = 0.2, - bf.prior = 0.707, - ...) { +corr_test <- function( + data, + x, + y, + type = "parametric", + k = 2L, + conf.level = 0.95, + tr = 0.2, + bf.prior = 0.707, + ...) { type <- stats_type_switch(type) stats_df <- correlation::correlation( diff --git a/R/data.R b/R/data.R index fd07fff4..98d1cbda 100644 --- a/R/data.R +++ b/R/data.R @@ -20,9 +20,9 @@ #' - votes. Number of IMDB users who rated this movie. #' - mpaa. MPAA rating. #' - action, animation, comedy, drama, documentary, romance, short. Binary -#' variables representing if movie was classified as belonging to that genre. +#' variables representing if movie was classified as belonging to that genre. #' - NumGenre. The number of different genres a film was classified in an -#' integer between one and four. +#' integer between one and four. #' #' @source #' @@ -54,7 +54,7 @@ #' - votes. Number of IMDB users who rated this movie. #' - mpaa. MPAA rating. #' - genre. Different genres of movies (action, animation, comedy, drama, -#' documentary, romance, short). +#' documentary, romance, short). #' #' @source #' @@ -78,13 +78,13 @@ #' #' - id. Dummy identity number for each flower (150 flowers in total). #' - Species. The species are *Iris setosa*, *versicolor*, and -#' *virginica*. +#' *virginica*. #' - condition. Factor giving a detailed description of the attribute -#' (Four levels: `"Petal.Length"`, `"Petal.Width"`, `"Sepal.Length"`, -#' `"Sepal.Width"`). +#' (Four levels: `"Petal.Length"`, `"Petal.Width"`, `"Sepal.Length"`, +#' `"Sepal.Width"`). #' - attribute. What attribute is being measured (`"Sepal"` or `"Pepal"`). #' - measure. What aspect of the attribute is being measured (`"Length"` -#' or `"Width"`). +#' or `"Width"`). #' - value. Value of the measurement. #' #' @examples @@ -107,12 +107,12 @@ #' - region. Region of the world the participant was from. #' - education. Level of education. #' - condition. Condition of the experiment the participant gave rating -#' for (**LDLF**: low freighteningness and low disgustingness; **LFHD**: low -#' freighteningness and high disgustingness; **HFHD**: high freighteningness -#' and low disgustingness; **HFHD**: high freighteningness and high -#' disgustingness). +#' for (**LDLF**: low freighteningness and low disgustingness; **LFHD**: low +#' freighteningness and high disgustingness; **HFHD**: high freighteningness +#' and low disgustingness; **HFHD**: high freighteningness and high +#' disgustingness). #' - desire. The desire to kill an arthropod was indicated on a scale from -#' 0 to 10. +#' 0 to 10. #' #' @source #' diff --git a/R/helpers_easystats.R b/R/helpers-easystats.R similarity index 85% rename from R/helpers_easystats.R rename to R/helpers-easystats.R index 37e7a6db..cad6c7a2 100644 --- a/R/helpers_easystats.R +++ b/R/helpers-easystats.R @@ -33,7 +33,7 @@ tidy_model_parameters <- function(model, ...) { # remove estimates and CIs and use R2 data frame instead stats_df %<>% - dplyr::select(-matches("^est|^conf|^comp")) %>% + select(-matches("^est|^conf|^comp")) %>% filter(if_any(matches("effect"), ~ (.x == "fixed"))) %>% bind_cols(df_r2) } @@ -55,11 +55,9 @@ tidy_model_parameters <- function(model, ...) { #' tidy_model_effectsize(df) #' @noRd tidy_model_effectsize <- function(data, ...) { - bind_cols( - data %>% - mutate(effectsize = stats::na.omit(effectsize::get_effectsize_label(colnames(.)))) %>% - standardize_names(style = "broom") %>% - select(-contains("term")), - rename_with(as_tibble(data %@% "ci_method"), ~ paste0("conf.", .x)) - ) + data %>% + mutate(effectsize = stats::na.omit(effectsize::get_effectsize_label(colnames(.)))) %>% + standardize_names(style = "broom") %>% + select(-contains("term")) %>% + bind_cols(rename_with(as_tibble(data %@% "ci_method"), ~ paste0("conf.", .x))) } diff --git a/R/long_to_wide_converter.R b/R/long-to-wide-converter.R similarity index 90% rename from R/long_to_wide_converter.R rename to R/long-to-wide-converter.R index 968cebdb..b38a8b78 100644 --- a/R/long_to_wide_converter.R +++ b/R/long-to-wide-converter.R @@ -46,7 +46,9 @@ #' #' # repeated measures design #' long_to_wide_converter( -#' bugs_long, condition, desire, +#' bugs_long, +#' condition, +#' desire, #' subject.id = subject, #' paired = TRUE #' ) @@ -54,13 +56,14 @@ #' # independent measures design #' long_to_wide_converter(mtcars, cyl, wt, paired = FALSE) #' @export -long_to_wide_converter <- function(data, - x, - y, - subject.id = NULL, - paired = TRUE, - spread = TRUE, - ...) { +long_to_wide_converter <- function( + data, + x, + y, + subject.id = NULL, + paired = TRUE, + spread = TRUE, + ...) { data %<>% select({{ x }}, {{ y }}, .rowid = {{ subject.id }}) %>% mutate({{ x }} := droplevels(as.factor({{ x }}))) %>% diff --git a/R/meta_analysis.R b/R/meta-analysis.R similarity index 86% rename from R/meta_analysis.R rename to R/meta-analysis.R index b9936707..bccfe755 100644 --- a/R/meta_analysis.R +++ b/R/meta-analysis.R @@ -66,19 +66,20 @@ #' suppressWarnings(meta_analysis(dat, type = "bayes")) #' #' @export -meta_analysis <- function(data, - type = "parametric", - random = "mixture", - k = 2L, - conf.level = 0.95, - ...) { +meta_analysis <- function( + data, + type = "parametric", + random = "mixture", + k = 2L, + conf.level = 0.95, + ...) { type <- stats_type_switch(type) # nolint start: line_length_linter. c(.ns, .fn, .f.args) %<-% switch(type, parametric = list("metafor", "rma", list(yi = quote(estimate), sei = quote(std.error), ...)), - robust = list("metaplus", "metaplus", list(yi = quote(estimate), sei = quote(std.error), random = random, ...)), - bayes = list("metaBMA", "meta_random", list(y = quote(estimate), SE = quote(std.error), ...)) + robust = list("metaplus", "metaplus", list(yi = quote(estimate), sei = quote(std.error), random = random, ...)), + bayes = list("metaBMA", "meta_random", list(y = quote(estimate), SE = quote(std.error), ...)) ) # nolint end diff --git a/R/one_sample_test.R b/R/one-sample-test.R similarity index 77% rename from R/one_sample_test.R rename to R/one-sample-test.R index f1c4de81..764d2d2f 100644 --- a/R/one_sample_test.R +++ b/R/one-sample-test.R @@ -31,21 +31,22 @@ #' #' @autoglobal #' -#' @example man/examples/examples-one_sample_test.R +#' @example man/examples/examples-one-sample-test.R #' @export -one_sample_test <- function(data, - x, - type = "parametric", - test.value = 0, - alternative = "two.sided", - k = 2L, - conf.level = 0.95, - tr = 0.2, - bf.prior = 0.707, - effsize.type = "g", - ...) { +one_sample_test <- function( + data, + x, + type = "parametric", + test.value = 0, + alternative = "two.sided", + k = 2L, + conf.level = 0.95, + tr = 0.2, + bf.prior = 0.707, + effsize.type = "g", + ...) { type <- stats_type_switch(type) - x_vec <- stats::na.omit(data %>% pull({{ x }})) + x_vec <- stats::na.omit(pull(data, {{ x }})) # parametric --------------------------------------- @@ -53,13 +54,12 @@ one_sample_test <- function(data, .f <- stats::t.test # styler: off if (effsize.type %in% c("unbiased", "g")) .f.es <- effectsize::hedges_g - if (effsize.type %in% c("biased", "d")) .f.es <- effectsize::cohens_d + if (effsize.type %in% c("biased", "d")) .f.es <- effectsize::cohens_d # styler: on } # non-parametric --------------------------------------- - if (type == "nonparametric") c(.f, .f.es) %<-% c(stats::wilcox.test, effectsize::rank_biserial) if (type %in% c("parametric", "nonparametric")) { @@ -82,7 +82,7 @@ one_sample_test <- function(data, # robust --------------------------------------- if (type == "robust") { - stats_df <- exec(WRS2::trimcibt, x = x_vec, nv = test.value, tr = tr, alpha = 1 - conf.level) %>% + stats_df <- exec(WRS2::trimcibt, x = x_vec, nv = test.value, tr = tr, alpha = 1.0 - conf.level) %>% tidy_model_parameters() } diff --git a/R/oneway_anova.R b/R/oneway-anova.R similarity index 90% rename from R/oneway_anova.R rename to R/oneway-anova.R index 71158633..5092a943 100644 --- a/R/oneway_anova.R +++ b/R/oneway-anova.R @@ -128,20 +128,23 @@ #' type = "bayes" #' ) #' @export -oneway_anova <- function(data, - x, - y, - subject.id = NULL, - type = "parametric", - paired = FALSE, - k = 2L, - conf.level = 0.95, - effsize.type = "omega", - var.equal = FALSE, - bf.prior = 0.707, - tr = 0.2, - nboot = 100L, - ...) { +oneway_anova <- function( + data, + x, + y, + subject.id = NULL, + type = "parametric", + paired = FALSE, + k = 2L, + conf.level = 0.95, + effsize.type = "omega", + var.equal = FALSE, + bf.prior = 0.707, + tr = 0.2, + nboot = 100L, + ...) { + # data ------------------------------------------- + type <- stats_type_switch(type) c(x, y) %<-% c(ensym(x), ensym(y)) @@ -161,7 +164,7 @@ oneway_anova <- function(data, # styler: off if (effsize.type %in% c("unbiased", "omega")) .f.es <- effectsize::omega_squared - if (effsize.type %in% c("biased", "eta")) .f.es <- effectsize::eta_squared + if (effsize.type %in% c("biased", "eta")) .f.es <- effectsize::eta_squared # styler: on if (paired) { @@ -223,10 +226,10 @@ oneway_anova <- function(data, if (paired) { mod <- WRS2::rmanova( - y = data[[as_name(y)]], - groups = data[[as_name(x)]], - blocks = data[[".rowid"]], - tr = tr + y = data[[as_name(y)]], + groups = data[[as_name(x)]], + blocks = data[[".rowid"]], + tr = tr ) } diff --git a/R/pairwise_comparisons.R b/R/pairwise-comparisons.R similarity index 84% rename from R/pairwise_comparisons.R rename to R/pairwise-comparisons.R index bf6deb02..8d51905e 100644 --- a/R/pairwise_comparisons.R +++ b/R/pairwise-comparisons.R @@ -138,23 +138,24 @@ #' paired = TRUE #' ) #' @export -pairwise_comparisons <- function(data, - x, - y, - subject.id = NULL, - type = "parametric", - paired = FALSE, - var.equal = FALSE, - tr = 0.2, - bf.prior = 0.707, - p.adjust.method = "holm", - k = 2L, - ...) { +pairwise_comparisons <- function( + data, + x, + y, + subject.id = NULL, + type = "parametric", + paired = FALSE, + var.equal = FALSE, + tr = 0.2, + bf.prior = 0.707, + p.adjust.method = "holm", + k = 2L, + ...) { + # data ------------------------------------------- + type <- stats_type_switch(type) c(x, y) %<-% c(ensym(x), ensym(y)) - # data frame ------------------------------- - data %<>% long_to_wide_converter( x = {{ x }}, y = {{ y }}, @@ -172,22 +173,26 @@ pairwise_comparisons <- function(data, # parametric --------------------------------- if (type %in% c("parametric", "bayes")) { - if (var.equal || paired) c(.f, test) %<-% c(stats::pairwise.t.test, "Student's t") + # styler: off + if (var.equal || paired) c(.f, test) %<-% c(stats::pairwise.t.test, "Student's t") if (!(var.equal || paired)) c(.f, test) %<-% c(PMCMRplus::gamesHowellTest, "Games-Howell") + # styler: on } # nonparametric ---------------------------- if (type == "nonparametric") { + # styler: off if (!paired) c(.f, test) %<-% c(PMCMRplus::kwAllPairsDunnTest, "Dunn") - if (paired) c(.f, test) %<-% c(PMCMRplus::durbinAllPairsTest, "Durbin-Conover") + if (paired) c(.f, test) %<-% c(PMCMRplus::durbinAllPairsTest, "Durbin-Conover") + # styler: on # `exec` fails otherwise for `pairwise.t.test` because `y` is passed to `t.test` .f.args <- utils::modifyList(.f.args, list(y = y_vec)) } if (type != "robust") { - df <- suppressWarnings(exec( + df_pair <- suppressWarnings(exec( .f, # Dunn, Games-Howell, Student's t-test x = y_vec, @@ -216,8 +221,7 @@ pairwise_comparisons <- function(data, .f.args <- list(y = quote(y_vec), groups = quote(x_vec), blocks = quote(g_vec)) } - df <- eval(call2(.ns = .ns, .fn = .fn, tr = tr, !!!.f.args)) %>% tidy_model_parameters() - + df_pair <- eval(call2(.ns = .ns, .fn = .fn, tr = tr, !!!.f.args)) %>% tidy_model_parameters() test <- "Yuen's trimmed means" } @@ -227,8 +231,8 @@ pairwise_comparisons <- function(data, df_tidy <- map_dfr( # creating a list of data frames with subsections of data .x = map2( - .x = as.character(df$group1), - .y = as.character(df$group2), + .x = as.character(df_pair$group1), + .y = as.character(df_pair$group2), .f = function(a, b) droplevels(filter(data, {{ x }} %in% c(a, b))) ), .f = ~ two_sample_test( @@ -241,27 +245,27 @@ pairwise_comparisons <- function(data, ) ) %>% filter(term == "Difference") %>% - mutate(expression = glue("list(log[e]*(BF['01'])=='{format_value(-log(bf10), k)}')")) %>% - mutate(test = "Student's t") + mutate( + expression = glue("list(log[e]*(BF['01'])=='{format_value(-log(bf10), k)}')"), + test = "Student's t" + ) - df <- bind_cols(select(df, group1, group2), df_tidy) + df_pair <- bind_cols(select(df_pair, group1, group2), df_tidy) } # expression formatting ---------------------------------- - df %<>% + df_pair %<>% mutate(across(where(is.factor), ~ as.character())) %>% arrange(group1, group2) %>% select(group1, group2, everything()) if (type != "bayes") { - df %<>% + df_pair %<>% mutate( - p.value = stats::p.adjust(p = p.value, method = p.adjust.method), + p.value = stats::p.adjust(p = p.value, method = p.adjust.method), p.adjust.method = p_adjust_text(p.adjust.method), - test = test - ) %>% - mutate( + test = test, expression = case_when( p.adjust.method == "None" ~ glue("list(italic(p)[unadj.]=='{format_value(p.value, k)}')"), .default = glue("list(italic(p)['{p.adjust.method}'-adj.]=='{format_value(p.value, k)}')") @@ -269,7 +273,7 @@ pairwise_comparisons <- function(data, ) } - select(df, everything(), -matches("p.adjustment|^method$")) %>% + select(df_pair, everything(), -matches("p.adjustment|^method$")) %>% .glue_to_expression() } diff --git a/R/reexports.R b/R/reexports.R index d5f1a4d4..511cf730 100644 --- a/R/reexports.R +++ b/R/reexports.R @@ -1,19 +1,19 @@ # DO NOT REMOVE: Needed for `{ggstatsplot}` #' @export -#' @importFrom magrittr "%>%" +#' @importFrom magrittr %>% magrittr::`%>%` #' @export -#' @importFrom magrittr "%<>%" +#' @importFrom magrittr %<>% magrittr::`%<>%` #' @export -#' @importFrom magrittr "%$%" +#' @importFrom magrittr %$% magrittr::`%$%` #' @export -#' @importFrom zeallot "%<-%" +#' @importFrom zeallot %<-% zeallot::`%<-%` #' @export diff --git a/R/statsExpressions-package.R b/R/statsExpressions-package.R index 0cfa500d..23fa60be 100644 --- a/R/statsExpressions-package.R +++ b/R/statsExpressions-package.R @@ -21,8 +21,6 @@ #' @import dplyr #' @import glue #' -#' @importFrom magrittr "%$%" -#' @importFrom zeallot "%<-%" #' @importFrom insight format_value check_if_installed standardize_names #' @importFrom parameters model_parameters #' @importFrom purrr map2 map_dbl map_dfr diff --git a/R/switch_functions.R b/R/switch-functions.R similarity index 97% rename from R/switch_functions.R rename to R/switch-functions.R index 646ed57e..e90d2a0e 100644 --- a/R/switch_functions.R +++ b/R/switch-functions.R @@ -93,6 +93,7 @@ prior_switch <- function(x) { ) } +#' @note Don't curry using `purrr::partial()` because it causes `Found a .Internal call` warning. #' @noRd .grepl <- function(pattern, x) grepl(pattern, x, fixed = TRUE) diff --git a/R/tidy_model_expressions.R b/R/tidy-model-expressions.R similarity index 81% rename from R/tidy_model_expressions.R rename to R/tidy-model-expressions.R index 8a637a5d..619c050c 100644 --- a/R/tidy_model_expressions.R +++ b/R/tidy-model-expressions.R @@ -33,11 +33,12 @@ #' tidy_model_expressions(df, statistic = "z") #' tidy_model_expressions(df, statistic = "chi") #' @export -tidy_model_expressions <- function(data, - statistic = NULL, - k = 2L, - effsize.type = "omega", - ...) { +tidy_model_expressions <- function( + data, + statistic = NULL, + k = 2L, + effsize.type = "omega", + ...) { # standardize the statistic naming statistic <- substring(tolower(statistic), 1L, 1L) @@ -45,7 +46,7 @@ tidy_model_expressions <- function(data, # expression corresponding to that row # # convert the necessary columns to character type for expression - df <- data %>% + df_expr <- data %>% filter(if_all( .cols = matches("estimate|statistic|std.error|p.value"), .fns = Negate(is.na) @@ -59,7 +60,7 @@ tidy_model_expressions <- function(data, # nolint start: line_length_linter. if (statistic == "t") { - df %<>% mutate( + df_expr %<>% mutate( expression = case_when( df.error %in% c("NA", "Inf") ~ glue("list({es.text}=='{estimate}', italic(t)=='{statistic}', italic(p)=='{p.value}')"), .default = glue("list({es.text}=='{estimate}', italic(t)('{df.error}')=='{statistic}', italic(p)=='{p.value}')") @@ -70,13 +71,13 @@ tidy_model_expressions <- function(data, # z-statistic --------------------------------- if (statistic == "z") { - df %<>% mutate(expression = glue("list({es.text}=='{estimate}', italic(z)=='{statistic}', italic(p)=='{p.value}')")) + df_expr %<>% mutate(expression = glue("list({es.text}=='{estimate}', italic(z)=='{statistic}', italic(p)=='{p.value}')")) } # chi^2-statistic ----------------------------- if (statistic == "c") { - df %<>% mutate(expression = glue("list({es.text}=='{estimate}', italic(chi)^2*('{df.error}')=='{statistic}', italic(p)=='{p.value}')")) + df_expr %<>% mutate(expression = glue("list({es.text}=='{estimate}', italic(chi)^2*('{df.error}')=='{statistic}', italic(p)=='{p.value}')")) } # f-statistic --------------------------------- @@ -85,13 +86,13 @@ tidy_model_expressions <- function(data, if (effsize.type == "eta") es.text <- list(quote(widehat(italic(eta)[p]^2))) if (effsize.type == "omega") es.text <- list(quote(widehat(italic(omega)[p]^2))) - df %<>% mutate(expression = glue("list({es.text}=='{estimate}', italic(F)('{df}', '{df.error}')=='{statistic}', italic(p)=='{p.value}')")) + df_expr %<>% mutate(expression = glue("list({es.text}=='{estimate}', italic(F)('{df}', '{df.error}')=='{statistic}', italic(p)=='{p.value}')")) } # nolint end # Replace `NA` with `NULL` to show nothing instead of an empty string ("") - left_join(data, select(df, term, expression), by = "term") %>% + left_join(data, select(df_expr, term, expression), by = "term") %>% .glue_to_expression() } diff --git a/R/two_sample_test.R b/R/two-sample-test.R similarity index 82% rename from R/two_sample_test.R rename to R/two-sample-test.R index 8598e288..434d86fe 100644 --- a/R/two_sample_test.R +++ b/R/two-sample-test.R @@ -27,25 +27,28 @@ #' @autoglobal #' #' @examplesIf identical(Sys.getenv("NOT_CRAN"), "true") -#' @example man/examples/examples-two_sample_test_within.R -#' @example man/examples/examples-two_sample_test_between.R +#' @example man/examples/examples-two-sample-test-within.R +#' @example man/examples/examples-two-sample-test-between.R #' #' @export -two_sample_test <- function(data, - x, - y, - subject.id = NULL, - type = "parametric", - paired = FALSE, - alternative = "two.sided", - k = 2L, - conf.level = 0.95, - effsize.type = "g", - var.equal = FALSE, - bf.prior = 0.707, - tr = 0.2, - nboot = 100L, - ...) { +two_sample_test <- function( + data, + x, + y, + subject.id = NULL, + type = "parametric", + paired = FALSE, + alternative = "two.sided", + k = 2L, + conf.level = 0.95, + effsize.type = "g", + var.equal = FALSE, + bf.prior = 0.707, + tr = 0.2, + nboot = 100L, + ...) { + # data ------------------------------------------- + type <- stats_type_switch(type) c(x, y) %<-% c(ensym(x), ensym(y)) diff --git a/README.Rmd b/README.Rmd index 8d7d2f2a..2f95c443 100644 --- a/README.Rmd +++ b/README.Rmd @@ -41,6 +41,13 @@ Type | Source | Command Release | [![CRAN Status](https://www.r-pkg.org/badges/version/statsExpressions)](https://cran.r-project.org/package=statsExpressions) | `install.packages("statsExpressions")` Development | [![Project Status](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/##active) | `pak::pak("IndrajeetPatil/statsExpressions")` +On Linux, `{statsExpressions}` installation may require additional system dependencies, which can be checked using: + +```{r, eval=FALSE} +pak::pkg_sysreqs("statsExpressions") +``` + + # Citation The package can be cited as: diff --git a/README.md b/README.md index 8470a562..29aab8aa 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,13 @@ For more documentation, see the dedicated | Release | [![CRAN Status](https://www.r-pkg.org/badges/version/statsExpressions)](https://cran.r-project.org/package=statsExpressions) | `install.packages("statsExpressions")` | | Development | [![Project Status](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/##active) | `pak::pak("IndrajeetPatil/statsExpressions")` | +On Linux, `{statsExpressions}` installation may require additional +system dependencies, which can be checked using: + +``` r +pak::pkg_sysreqs("statsExpressions") +``` + # Citation The package can be cited as: diff --git a/WIP/additional_args.R b/WIP/additional-args.R similarity index 100% rename from WIP/additional_args.R rename to WIP/additional-args.R diff --git a/codemeta.json b/codemeta.json index 59020e40..9dc166a0 100644 --- a/codemeta.json +++ b/codemeta.json @@ -14,7 +14,7 @@ "name": "R", "url": "https://r-project.org" }, - "runtimePlatform": "R version 4.3.1 (2023-06-16)", + "runtimePlatform": "R version 4.3.2 (2023-10-31)", "provider": { "@id": "https://cran.r-project.org", "@type": "Organization", @@ -53,6 +53,7 @@ "@type": "SoftwareApplication", "identifier": "bayestestR", "name": "bayestestR", + "version": ">= 0.13.1", "provider": { "@id": "https://cran.r-project.org", "@type": "Organization", @@ -161,7 +162,7 @@ "@type": "SoftwareApplication", "identifier": "testthat", "name": "testthat", - "version": ">= 3.2.0", + "version": ">= 3.2.1", "provider": { "@id": "https://cran.r-project.org", "@type": "Organization", @@ -200,7 +201,7 @@ "@type": "SoftwareApplication", "identifier": "BayesFactor", "name": "BayesFactor", - "version": ">= 0.9.12-4.5", + "version": ">= 0.9.12-4.6", "provider": { "@id": "https://cran.r-project.org", "@type": "Organization", @@ -239,7 +240,7 @@ "@type": "SoftwareApplication", "identifier": "dplyr", "name": "dplyr", - "version": ">= 1.1.3", + "version": ">= 1.1.4", "provider": { "@id": "https://cran.r-project.org", "@type": "Organization", @@ -277,7 +278,7 @@ "@type": "SoftwareApplication", "identifier": "insight", "name": "insight", - "version": ">= 0.19.6", + "version": ">= 0.19.7", "provider": { "@id": "https://cran.r-project.org", "@type": "Organization", @@ -302,7 +303,7 @@ "@type": "SoftwareApplication", "identifier": "parameters", "name": "parameters", - "version": ">= 0.21.2", + "version": ">= 0.21.3", "provider": { "@id": "https://cran.r-project.org", "@type": "Organization", @@ -430,7 +431,7 @@ }, "SystemRequirements": null }, - "fileSize": "4132.149KB", + "fileSize": "4127.543KB", "citation": [ { "@type": "ScholarlyArticle", diff --git a/man/add_expression_col.Rd b/man/add_expression_col.Rd index 52711300..a77aba4c 100644 --- a/man/add_expression_col.Rd +++ b/man/add_expression_col.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/add_expression_col.R +% Please edit documentation in R/add-expression-col.R \name{add_expression_col} \alias{add_expression_col} \title{Template for expressions with statistical details} diff --git a/man/centrality_description.Rd b/man/centrality_description.Rd index 436305f7..7f4c3294 100644 --- a/man/centrality_description.Rd +++ b/man/centrality_description.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/centrality_description.R +% Please edit documentation in R/centrality-description.R \name{centrality_description} \alias{centrality_description} \title{Data frame and expression for distribution properties} diff --git a/man/contingency_table.Rd b/man/contingency_table.Rd index 2ca897e4..ce4903cd 100644 --- a/man/contingency_table.Rd +++ b/man/contingency_table.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/contingency_table.R +% Please edit documentation in R/contingency-table.R \name{contingency_table} \alias{contingency_table} \title{Contingency table analyses} diff --git a/man/corr_test.Rd b/man/corr_test.Rd index 60dd88b8..4e04338b 100644 --- a/man/corr_test.Rd +++ b/man/corr_test.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/corr_test.R +% Please edit documentation in R/corr-test.R \name{corr_test} \alias{corr_test} \title{Correlation analyses} diff --git a/man/examples/examples-centrality_description.R b/man/examples/examples-centrality-description.R similarity index 100% rename from man/examples/examples-centrality_description.R rename to man/examples/examples-centrality-description.R diff --git a/man/examples/examples-corr_test.R b/man/examples/examples-corr-test.R similarity index 100% rename from man/examples/examples-corr_test.R rename to man/examples/examples-corr-test.R diff --git a/man/examples/examples-one_sample_test.R b/man/examples/examples-one-sample-test.R similarity index 100% rename from man/examples/examples-one_sample_test.R rename to man/examples/examples-one-sample-test.R diff --git a/man/examples/examples-two_sample_test_between.R b/man/examples/examples-two-sample-test-between.R similarity index 100% rename from man/examples/examples-two_sample_test_between.R rename to man/examples/examples-two-sample-test-between.R diff --git a/man/examples/examples-two_sample_test_within.R b/man/examples/examples-two-sample-test-within.R similarity index 100% rename from man/examples/examples-two_sample_test_within.R rename to man/examples/examples-two-sample-test-within.R diff --git a/man/long_to_wide_converter.Rd b/man/long_to_wide_converter.Rd index f367f207..c3e28883 100644 --- a/man/long_to_wide_converter.Rd +++ b/man/long_to_wide_converter.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/long_to_wide_converter.R +% Please edit documentation in R/long-to-wide-converter.R \name{long_to_wide_converter} \alias{long_to_wide_converter} \title{Convert long/tidy data frame to wide format} @@ -64,7 +64,9 @@ set.seed(123) # repeated measures design long_to_wide_converter( - bugs_long, condition, desire, + bugs_long, + condition, + desire, subject.id = subject, paired = TRUE ) diff --git a/man/meta_analysis.Rd b/man/meta_analysis.Rd index 0af7f8c4..a438d607 100644 --- a/man/meta_analysis.Rd +++ b/man/meta_analysis.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/meta_analysis.R +% Please edit documentation in R/meta-analysis.R \name{meta_analysis} \alias{meta_analysis} \title{Random-effects meta-analysis} diff --git a/man/one_sample_test.Rd b/man/one_sample_test.Rd index 5d062ea6..f7402a8d 100644 --- a/man/one_sample_test.Rd +++ b/man/one_sample_test.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/one_sample_test.R +% Please edit documentation in R/one-sample-test.R \name{one_sample_test} \alias{one_sample_test} \title{One-sample tests} diff --git a/man/oneway_anova.Rd b/man/oneway_anova.Rd index 38cd6434..214de976 100644 --- a/man/oneway_anova.Rd +++ b/man/oneway_anova.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/oneway_anova.R +% Please edit documentation in R/oneway-anova.R \name{oneway_anova} \alias{oneway_anova} \title{One-way analysis of variance (ANOVA)} diff --git a/man/p_adjust_text.Rd b/man/p_adjust_text.Rd index 875fa42b..be42eff4 100644 --- a/man/p_adjust_text.Rd +++ b/man/p_adjust_text.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/pairwise_comparisons.R +% Please edit documentation in R/pairwise-comparisons.R \name{p_adjust_text} \alias{p_adjust_text} \title{\emph{p}-value adjustment method text} diff --git a/man/pairwise_comparisons.Rd b/man/pairwise_comparisons.Rd index 67b0333f..1ef9f336 100644 --- a/man/pairwise_comparisons.Rd +++ b/man/pairwise_comparisons.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/pairwise_comparisons.R +% Please edit documentation in R/pairwise-comparisons.R \name{pairwise_comparisons} \alias{pairwise_comparisons} \title{Multiple pairwise comparison for one-way design} diff --git a/man/statsExpressions-package.Rd b/man/statsExpressions-package.Rd index 9bd969a8..06244b19 100644 --- a/man/statsExpressions-package.Rd +++ b/man/statsExpressions-package.Rd @@ -3,7 +3,6 @@ \docType{package} \name{statsExpressions-package} \alias{statsExpressions-package} -\alias{_PACKAGE} \alias{statsExpressions} \title{statsExpressions: Tidy Dataframes and Expressions with Statistical Details} \description{ diff --git a/man/stats_type_switch.Rd b/man/stats_type_switch.Rd index db42b916..20c3c524 100644 --- a/man/stats_type_switch.Rd +++ b/man/stats_type_switch.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/switch_functions.R +% Please edit documentation in R/switch-functions.R \name{stats_type_switch} \alias{stats_type_switch} \title{Switch the type of statistics.} diff --git a/man/tidy_model_expressions.Rd b/man/tidy_model_expressions.Rd index a924ba90..62ba13a8 100644 --- a/man/tidy_model_expressions.Rd +++ b/man/tidy_model_expressions.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/tidy_model_expressions.R +% Please edit documentation in R/tidy-model-expressions.R \name{tidy_model_expressions} \alias{tidy_model_expressions} \title{Expressions with statistics for tidy regression data frames} diff --git a/man/tidy_model_parameters.Rd b/man/tidy_model_parameters.Rd index 087b9cc4..980483c8 100644 --- a/man/tidy_model_parameters.Rd +++ b/man/tidy_model_parameters.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/helpers_easystats.R +% Please edit documentation in R/helpers-easystats.R \name{tidy_model_parameters} \alias{tidy_model_parameters} \title{Convert \code{{parameters}} package output to \code{{tidyverse}} conventions} diff --git a/man/two_sample_test.Rd b/man/two_sample_test.Rd index decd8dee..52ecd827 100644 --- a/man/two_sample_test.Rd +++ b/man/two_sample_test.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/two_sample_test.R +% Please edit documentation in R/two-sample-test.R \name{two_sample_test} \alias{two_sample_test} \title{Two-sample tests} diff --git a/tests/testthat/_snaps/centrality_description.md b/tests/testthat/_snaps/centrality-description.md similarity index 100% rename from tests/testthat/_snaps/centrality_description.md rename to tests/testthat/_snaps/centrality-description.md diff --git a/tests/testthat/_snaps/contingency_table.md b/tests/testthat/_snaps/contingency-table.md similarity index 100% rename from tests/testthat/_snaps/contingency_table.md rename to tests/testthat/_snaps/contingency-table.md diff --git a/tests/testthat/_snaps/corr_test.md b/tests/testthat/_snaps/corr-test.md similarity index 100% rename from tests/testthat/_snaps/corr_test.md rename to tests/testthat/_snaps/corr-test.md diff --git a/tests/testthat/_snaps/long_to_wide_converter.md b/tests/testthat/_snaps/long-to-wide-converter.md similarity index 100% rename from tests/testthat/_snaps/long_to_wide_converter.md rename to tests/testthat/_snaps/long-to-wide-converter.md diff --git a/tests/testthat/_snaps/meta_random_bayes.md b/tests/testthat/_snaps/meta-random-bayes.md similarity index 100% rename from tests/testthat/_snaps/meta_random_bayes.md rename to tests/testthat/_snaps/meta-random-bayes.md diff --git a/tests/testthat/_snaps/meta_random_parametric.md b/tests/testthat/_snaps/meta-random-parametric.md similarity index 100% rename from tests/testthat/_snaps/meta_random_parametric.md rename to tests/testthat/_snaps/meta-random-parametric.md diff --git a/tests/testthat/_snaps/meta_random_robust.md b/tests/testthat/_snaps/meta-random-robust.md similarity index 100% rename from tests/testthat/_snaps/meta_random_robust.md rename to tests/testthat/_snaps/meta-random-robust.md diff --git a/tests/testthat/_snaps/one_sample.md b/tests/testthat/_snaps/one-sample.md similarity index 100% rename from tests/testthat/_snaps/one_sample.md rename to tests/testthat/_snaps/one-sample.md diff --git a/tests/testthat/_snaps/one_two_sample_dataframes.md b/tests/testthat/_snaps/one-two-sample-dataframes.md similarity index 100% rename from tests/testthat/_snaps/one_two_sample_dataframes.md rename to tests/testthat/_snaps/one-two-sample-dataframes.md diff --git a/tests/testthat/_snaps/oneway_anova_bayes.md b/tests/testthat/_snaps/oneway-anova-bayes.md similarity index 100% rename from tests/testthat/_snaps/oneway_anova_bayes.md rename to tests/testthat/_snaps/oneway-anova-bayes.md diff --git a/tests/testthat/_snaps/oneway_anova_nonparametric.md b/tests/testthat/_snaps/oneway-anova-nonparametric.md similarity index 100% rename from tests/testthat/_snaps/oneway_anova_nonparametric.md rename to tests/testthat/_snaps/oneway-anova-nonparametric.md diff --git a/tests/testthat/_snaps/oneway_anova_parametric.md b/tests/testthat/_snaps/oneway-anova-parametric.md similarity index 100% rename from tests/testthat/_snaps/oneway_anova_parametric.md rename to tests/testthat/_snaps/oneway-anova-parametric.md diff --git a/tests/testthat/_snaps/oneway_anova_robust.md b/tests/testthat/_snaps/oneway-anova-robust.md similarity index 100% rename from tests/testthat/_snaps/oneway_anova_robust.md rename to tests/testthat/_snaps/oneway-anova-robust.md diff --git a/tests/testthat/_snaps/pairwise_comparisons.md b/tests/testthat/_snaps/pairwise-comparisons.md similarity index 100% rename from tests/testthat/_snaps/pairwise_comparisons.md rename to tests/testthat/_snaps/pairwise-comparisons.md diff --git a/tests/testthat/_snaps/tidy_model_expressions.md b/tests/testthat/_snaps/tidy-model-expressions.md similarity index 100% rename from tests/testthat/_snaps/tidy_model_expressions.md rename to tests/testthat/_snaps/tidy-model-expressions.md diff --git a/tests/testthat/_snaps/two_sample_bayes.md b/tests/testthat/_snaps/two-sample-bayes.md similarity index 100% rename from tests/testthat/_snaps/two_sample_bayes.md rename to tests/testthat/_snaps/two-sample-bayes.md diff --git a/tests/testthat/_snaps/two_sample_nonparametric.md b/tests/testthat/_snaps/two-sample-nonparametric.md similarity index 100% rename from tests/testthat/_snaps/two_sample_nonparametric.md rename to tests/testthat/_snaps/two-sample-nonparametric.md diff --git a/tests/testthat/_snaps/two_sample_parametric.md b/tests/testthat/_snaps/two-sample-parametric.md similarity index 100% rename from tests/testthat/_snaps/two_sample_parametric.md rename to tests/testthat/_snaps/two-sample-parametric.md diff --git a/tests/testthat/_snaps/two_sample_robust.md b/tests/testthat/_snaps/two-sample-robust.md similarity index 100% rename from tests/testthat/_snaps/two_sample_robust.md rename to tests/testthat/_snaps/two-sample-robust.md diff --git a/tests/testthat/test-centrality_description.R b/tests/testthat/test-centrality-description.R similarity index 100% rename from tests/testthat/test-centrality_description.R rename to tests/testthat/test-centrality-description.R diff --git a/tests/testthat/test-contingency_table.R b/tests/testthat/test-contingency-table.R similarity index 98% rename from tests/testthat/test-contingency_table.R rename to tests/testthat/test-contingency-table.R index a61c8fe9..350fef59 100644 --- a/tests/testthat/test-contingency_table.R +++ b/tests/testthat/test-contingency-table.R @@ -16,7 +16,7 @@ test_that( expect_snapshot(select(df1, -expression)) expect_snapshot(df1[["expression"]]) - # with counts + set.seed(123) df2 <- contingency_table( data = as.data.frame(Titanic), @@ -75,7 +75,6 @@ test_that( # paired data with NAs --------------------------------------------- - # untabling the data frame paired_data %<>% tidyr::uncount(weights = Freq) # deliberately introduce NAs @@ -122,7 +121,7 @@ test_that( expect_snapshot(select(df1, -expression)) expect_snapshot(df1[["expression"]]) - # with counts + set.seed(123) df2 <- contingency_table( data = as.data.frame(Titanic), diff --git a/tests/testthat/test-corr_test.R b/tests/testthat/test-corr-test.R similarity index 100% rename from tests/testthat/test-corr_test.R rename to tests/testthat/test-corr-test.R diff --git a/tests/testthat/test-long_to_wide_converter.R b/tests/testthat/test-long-to-wide-converter.R similarity index 77% rename from tests/testthat/test-long_to_wide_converter.R rename to tests/testthat/test-long-to-wide-converter.R index 85747cc0..0c8afe2e 100644 --- a/tests/testthat/test-long_to_wide_converter.R +++ b/tests/testthat/test-long-to-wide-converter.R @@ -107,7 +107,7 @@ test_that( test_that( desc = "with .rowid - without NA", code = { - df <- structure( + df_original <- structure( list( score = c(90, 90, 72.5, 45), condition = structure(c(1L, 2L, 2L, 1L), .Label = c("4", "5"), class = "factor"), @@ -117,18 +117,16 @@ test_that( class = c("tbl_df", "tbl", "data.frame") ) - df1 <- arrange(df, id) + df_arranged <- arrange(df_original, id) expect_identical( - long_to_wide_converter(df1, condition, score), - long_to_wide_converter(df, condition, score, id) + long_to_wide_converter(df_arranged, condition, score), + long_to_wide_converter(df_original, condition, score, id) ) expect_identical( - long_to_wide_converter(df1, condition, score, spread = FALSE) %>% - arrange(.rowid), - long_to_wide_converter(df, condition, score, id, spread = FALSE) %>% - arrange(.rowid) + arrange(long_to_wide_converter(df_arranged, condition, score, spread = FALSE), .rowid), + arrange(long_to_wide_converter(df_original, condition, score, id, spread = FALSE), .rowid) ) } ) @@ -139,21 +137,17 @@ test_that( test_that( desc = "with .rowid - with NA", code = { - df <- bugs_long - df1 <- arrange(bugs_long, subject) + df_original <- bugs_long + df_arranged <- arrange(bugs_long, subject) expect_identical( - long_to_wide_converter(df1, condition, desire) %>% - select(-.rowid), - long_to_wide_converter(df, condition, desire, subject) %>% - select(-.rowid) + select(long_to_wide_converter(df_arranged, condition, desire), -.rowid), + select(long_to_wide_converter(df_original, condition, desire, subject), -.rowid) ) expect_identical( - long_to_wide_converter(df1, condition, desire, spread = FALSE) %>% - select(-.rowid), - long_to_wide_converter(df, condition, desire, subject, spread = FALSE) %>% - select(-.rowid) + select(long_to_wide_converter(df_arranged, condition, desire, spread = FALSE), -.rowid), + select(long_to_wide_converter(df_original, condition, desire, subject, spread = FALSE), -.rowid) ) } ) diff --git a/tests/testthat/test-meta_random_bayes.R b/tests/testthat/test-meta-random-bayes.R similarity index 100% rename from tests/testthat/test-meta_random_bayes.R rename to tests/testthat/test-meta-random-bayes.R diff --git a/tests/testthat/test-meta_random_parametric.R b/tests/testthat/test-meta-random-parametric.R similarity index 100% rename from tests/testthat/test-meta_random_parametric.R rename to tests/testthat/test-meta-random-parametric.R diff --git a/tests/testthat/test-meta_random_robust.R b/tests/testthat/test-meta-random-robust.R similarity index 100% rename from tests/testthat/test-meta_random_robust.R rename to tests/testthat/test-meta-random-robust.R diff --git a/tests/testthat/test-one_sample.R b/tests/testthat/test-one-sample.R similarity index 96% rename from tests/testthat/test-one_sample.R rename to tests/testthat/test-one-sample.R index 88224c3e..061177f3 100644 --- a/tests/testthat/test-one_sample.R +++ b/tests/testthat/test-one-sample.R @@ -41,7 +41,7 @@ test_that( x = len, test.value = 20, type = "np", - k = 4 + k = 4L )) set.seed(123) @@ -50,7 +50,7 @@ test_that( x = brainwt, test.value = 0.25, type = "np", - k = 4 + k = 4L ) set.seed(123) @@ -110,7 +110,6 @@ test_that( expect_equal(df_results$bf10[[1]], 5.958171e+20, tolerance = 0.001) expect_snapshot(names(df_results)) - # extracting subtitle (without NA) set.seed(123) df1 <- one_sample_test( type = "bayes", @@ -124,7 +123,6 @@ test_that( expect_snapshot(df1[["expression"]]) - # extracting subtitle (with NA) set.seed(123) df2 <- one_sample_test( type = "bayes", diff --git a/tests/testthat/test-one_two_sample_dataframes.R b/tests/testthat/test-one-two-sample-dataframes.R similarity index 100% rename from tests/testthat/test-one_two_sample_dataframes.R rename to tests/testthat/test-one-two-sample-dataframes.R diff --git a/tests/testthat/test-oneway_anova_bayes.R b/tests/testthat/test-oneway-anova-bayes.R similarity index 100% rename from tests/testthat/test-oneway_anova_bayes.R rename to tests/testthat/test-oneway-anova-bayes.R diff --git a/tests/testthat/test-oneway_anova_nonparametric.R b/tests/testthat/test-oneway-anova-nonparametric.R similarity index 100% rename from tests/testthat/test-oneway_anova_nonparametric.R rename to tests/testthat/test-oneway-anova-nonparametric.R diff --git a/tests/testthat/test-oneway_anova_parametric.R b/tests/testthat/test-oneway-anova-parametric.R similarity index 99% rename from tests/testthat/test-oneway_anova_parametric.R rename to tests/testthat/test-oneway-anova-parametric.R index 3905173f..069cc5eb 100644 --- a/tests/testthat/test-oneway_anova_parametric.R +++ b/tests/testthat/test-oneway-anova-parametric.R @@ -47,7 +47,7 @@ test_that( x = vore, y = brainwt, effsize.type = "unbiased", - k = 4 + k = 4L ) set.seed(123) diff --git a/tests/testthat/test-oneway_anova_robust.R b/tests/testthat/test-oneway-anova-robust.R similarity index 100% rename from tests/testthat/test-oneway_anova_robust.R rename to tests/testthat/test-oneway-anova-robust.R diff --git a/tests/testthat/test-pairwise_comparisons.R b/tests/testthat/test-pairwise-comparisons.R similarity index 100% rename from tests/testthat/test-pairwise_comparisons.R rename to tests/testthat/test-pairwise-comparisons.R diff --git a/tests/testthat/test-print.R b/tests/testthat/test-print.R index e2d112f7..5cb4ebfe 100644 --- a/tests/testthat/test-print.R +++ b/tests/testthat/test-print.R @@ -7,7 +7,7 @@ test_that( old_tbl <- contingency_table(mtcars, am) capture.output({ - new_tbl <- old_tbl %>% print() + new_tbl <- print(old_tbl) }) new_option <- getOption("tibble.width") diff --git a/tests/testthat/test-stats_type_switch.R b/tests/testthat/test-stats-type-switch.R similarity index 100% rename from tests/testthat/test-stats_type_switch.R rename to tests/testthat/test-stats-type-switch.R diff --git a/tests/testthat/test-tidy_model_expressions.R b/tests/testthat/test-tidy-model-expressions.R similarity index 96% rename from tests/testthat/test-tidy_model_expressions.R rename to tests/testthat/test-tidy-model-expressions.R index c6035414..8bbdf010 100644 --- a/tests/testthat/test-tidy_model_expressions.R +++ b/tests/testthat/test-tidy-model-expressions.R @@ -81,7 +81,8 @@ test_that("tidy_model_expressions works - F", { set.seed(123) df1 <- tidy_model_expressions( - tidy_model_parameters(mod_f, + tidy_model_parameters( + mod_f, effectsize_type = "omega", table_wide = TRUE ), @@ -93,7 +94,8 @@ test_that("tidy_model_expressions works - F", { set.seed(123) df2 <- tidy_model_expressions( - tidy_model_parameters(mod_f, + tidy_model_parameters( + mod_f, effectsize_type = "eta", table_wide = TRUE ), diff --git a/tests/testthat/test-two_sample_bayes.R b/tests/testthat/test-two-sample-bayes.R similarity index 100% rename from tests/testthat/test-two_sample_bayes.R rename to tests/testthat/test-two-sample-bayes.R diff --git a/tests/testthat/test-two_sample_nonparametric.R b/tests/testthat/test-two-sample-nonparametric.R similarity index 100% rename from tests/testthat/test-two_sample_nonparametric.R rename to tests/testthat/test-two-sample-nonparametric.R diff --git a/tests/testthat/test-two_sample_parametric.R b/tests/testthat/test-two-sample-parametric.R similarity index 100% rename from tests/testthat/test-two_sample_parametric.R rename to tests/testthat/test-two-sample-parametric.R diff --git a/tests/testthat/test-two_sample_robust.R b/tests/testthat/test-two-sample-robust.R similarity index 98% rename from tests/testthat/test-two_sample_robust.R rename to tests/testthat/test-two-sample-robust.R index 302e6dbd..fd8b1f55 100644 --- a/tests/testthat/test-two_sample_robust.R +++ b/tests/testthat/test-two-sample-robust.R @@ -13,7 +13,7 @@ test_that( x = condition, y = value, paired = TRUE, - k = 4 + k = 4L ) set.seed(123) @@ -76,7 +76,7 @@ test_that( y = brainwt, paired = FALSE, conf.level = 0.90, - k = 4 + k = 4L ) set.seed(123) diff --git a/vignettes/statsExpressions.Rmd b/vignettes/statsExpressions.Rmd index a2ef67d1..80b34601 100644 --- a/vignettes/statsExpressions.Rmd +++ b/vignettes/statsExpressions.Rmd @@ -119,9 +119,9 @@ modified by changing a single argument: ```{r} #| label = "df_p" -mtcars %>% oneway_anova(cyl, wt, type = "nonparametric") +oneway_anova(mtcars, cyl, wt, type = "nonparametric") -mtcars %>% oneway_anova(cyl, wt, type = "robust") +oneway_anova(mtcars, cyl, wt, type = "robust") ``` These functions are also compatible with other popular data manipulation diff --git a/vignettes/web_only/dataframe_outputs.Rmd b/vignettes/web_only/dataframe_outputs.Rmd index 94b0bda5..bfb6942e 100644 --- a/vignettes/web_only/dataframe_outputs.Rmd +++ b/vignettes/web_only/dataframe_outputs.Rmd @@ -46,7 +46,7 @@ citation("statsExpressions") ```{r} #| label = "onesample", -#| file = "../../man/examples/examples-one_sample_test.R" +#| file = "../../man/examples/examples-one-sample-test.R" ``` ## Two-sample tests @@ -55,14 +55,14 @@ citation("statsExpressions") ```{r} #| label = "twosample_w", -#| file = "../../man/examples/examples-two_sample_test_within.R" +#| file = "../../man/examples/examples-two-sample-test-within.R" ``` ### between-subjects design ```{r} #| label = "twosample_b", -#| file = "../../man/examples/examples-two_sample_test_between.R" +#| file = "../../man/examples/examples-two-sample-test-between.R" ``` ## One-way ANOVAs @@ -257,7 +257,7 @@ contingency_table( ```{r} #| label = "corr", -#| file = "../../man/examples/examples-corr_test.R" +#| file = "../../man/examples/examples-corr-test.R" ``` ## Meta-analysis @@ -290,7 +290,7 @@ suppressWarnings(meta_analysis(df, type = "bayes")) ```{r} #| label = "centrality", -#| file = "../../man/examples/examples-centrality_description.R" +#| file = "../../man/examples/examples-centrality-description.R" ``` ## Pairwise comparisons for one-way design