Skip to content

Commit

Permalink
Merge branch 'main' into joss-paper-draft
Browse files Browse the repository at this point in the history
  • Loading branch information
IndrajeetPatil authored Nov 12, 2023
2 parents bdc3ce5 + d21dd4a commit 071fcab
Show file tree
Hide file tree
Showing 47 changed files with 1,005 additions and 1,118 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/html-5-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ on:
pull_request:
branches: [main, master]

name: HTML5 check
name: html-5-check

jobs:
HTML5-check:
html-5-check:
uses: easystats/workflows/.github/workflows/html-5-check.yaml@main
10 changes: 10 additions & 0 deletions .github/workflows/update-to-latest-easystats.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
on:
schedule:
# Check for dependency updates once a month
- cron: "0 0 1 * *"

name: update-to-latest-easystats

jobs:
update-to-latest-easystats:
uses: easystats/workflows/.github/workflows/update-to-latest-easystats.yaml@main
31 changes: 20 additions & 11 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: report
Type: Package
Title: Automated Reporting of Results and Statistical Models
Version: 0.5.7.10
Version: 0.5.7.13
Authors@R:
c(person(given = "Dominique",
family = "Makowski",
Expand Down Expand Up @@ -49,18 +49,18 @@ Description: The aim of the 'report' package is to bridge the gap between
This package converts statistical models and data frames into textual
reports suited for publication, ensuring standardization and quality
in results reporting.
License: GPL-3 | file LICENSE
License: MIT + file LICENSE
URL: https://easystats.github.io/report/
BugReports: https://github.com/easystats/report/issues
Depends:
R (>= 3.6)
Imports:
bayestestR (>= 0.13.0),
effectsize (> 0.8.2),
insight (>= 0.19.1),
parameters (>= 0.20.2),
performance (>= 0.10.2),
datawizard (>= 0.7.0),
bayestestR (>= 0.13.1),
effectsize (>= 0.8.6),
insight (>= 0.19.6),
parameters (>= 0.21.2),
performance (>= 0.10.8),
datawizard (>= 0.9.0),
stats,
tools,
utils
Expand All @@ -81,7 +81,7 @@ VignetteBuilder:
knitr
Encoding: UTF-8
Language: en-US
RoxygenNote: 7.2.3
RoxygenNote: 7.2.3.9000
Config/testthat/edition: 3
Config/Needs/website:
rstudio/bslib,
Expand Down Expand Up @@ -125,6 +125,9 @@ Collate:
'report_effectsize.R'
'report_htest_chi2.R'
'report_htest_cor.R'
'report_htest_fisher.R'
'report_htest_friedman.R'
'report_htest_kruskal.R'
'report_htest_ttest.R'
'report_htest_wilcox.R'
'report_info.R'
Expand All @@ -143,4 +146,10 @@ Collate:
'utils_grouped_df.R'
'zzz.R'
Roxygen: list(markdown = TRUE)
Remotes: easystats/insight
Remotes:
easystats/insight,
easystats/datawizard,
easystats/parameters,
easystats/effectsize,
easystats/bayestestR,
easystats/performance
676 changes: 2 additions & 674 deletions LICENSE

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# MIT License

Copyright (c) 2023 report authors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
8 changes: 8 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
# report 0.5.8

Major Changes

* This release changes the licensing model of `{see}` to an MIT license.

Minor changes

* `report` now supports variables of class `htest` for the Chi2, Friedman test, Fisher's exact test, and Kruskal-Wallis.

* `report` now supports variables of class `Date`, treating them like factors.

* `report` now supports objects of class `estimate_contrasts`, from easystats'
Expand All @@ -26,6 +32,8 @@ Bug fixes

* Fixed issue in `report_participants`, which did not print the `"gender"`
category for grouped output when that argument was written in lower-case.
Gender now also supports more alternate spellings, and age converts the
respective column to numeric.

* Fixed printing issue for intercept-only models.

Expand Down
2 changes: 1 addition & 1 deletion R/cite_easystats.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#' - `refs`: References or bibliography in the requested `format`
#'
#' @examples
#' \dontrun{
#' \donttest{
#' # Cite just the 'easystats' umbrella package:
#' cite_easystats()
#' summary(cite_easystats(), what = "all")
Expand Down
2 changes: 1 addition & 1 deletion R/report.aov.R
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ report_effectsize.aov <- function(x, ...) {
parameters <- paste0(interpretation, " (", statistics, ")")


# Return output

as.report_effectsize(parameters,
summary = parameters,
table = table,
Expand Down
2 changes: 1 addition & 1 deletion R/report.brmsfit.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#' @inherit report return seealso
#'
#' @examplesIf require("brms", quietly = TRUE)
#' \dontrun{
#' \donttest{
#' # Bayesian models
#' library(brms)
#' model <- suppressWarnings(brm(mpg ~ qsec + wt, data = mtcars, refresh = 0, iter = 300))
Expand Down
86 changes: 70 additions & 16 deletions R/report.htest.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,22 +53,39 @@ report_effectsize.htest <- function(x, ...) {
out <- .report_effectsize_ttest(x, table, dot_args)
}

# For wilcox test ---------------

if (model_info$is_ranktest && !model_info$is_correlation) {
out <- .report_effectsize_wilcox(x, table, dot_args)
# For friedman test ---------------

if (grepl("Friedman", attributes(x$statistic)$names, fixed = TRUE)) {
out <- .report_effectsize_friedman(x, table, dot_args)
} else if (!is.null(x$statistic) && grepl(
"Kruskal", attributes(x$statistic)$names,
fixed = TRUE
)) {
# For Kruskal-Wallis test ---------------

out <- .report_effectsize_kruskal(x, table, dot_args)
} else {
# For wilcox test ---------------

out <- .report_effectsize_wilcox(x, table, dot_args)
}
}

# For correlations ---------------
## For correlations ---------------

if (model_info$is_correlation) {
out <- .report_effectsize_correlation(x, table, dot_args)
}

# For Chi2 ---------------
## For Chi2 ---------------

if (model_info$is_chi2test) {
out <- .report_effectsize_chi2(x, table, dot_args)
if (chi2_type(x) == "fisher") {
out <- .report_effectsize_fisher(x, table, dot_args)
} else {
out <- .report_effectsize_chi2(x, table, dot_args)
}
}

# TODO: Chi-squared test -------------
Expand All @@ -81,7 +98,7 @@ report_effectsize.htest <- function(x, ...) {

parameters <- paste0(out$interpretation, " (", out$statistics, ")")

# Return output

as.report_effectsize(
parameters,
summary = parameters,
Expand Down Expand Up @@ -120,17 +137,20 @@ report_table.htest <- function(x, ...) {
out <- .report_table_ttest(table_full, effsize)
} else if (model_info$is_ranktest && !model_info$is_correlation) {
# wilcox test
# but same function for Friedman
out <- .report_table_wilcox(table_full, effsize)
} else if (model_info$is_chi2test) {
# chi2 test
out <- .report_table_chi2(table_full, effsize)
attr(out$table_full, "table_footer") <- attr(attr(effsize, "table"), "table_footer")
} else if (model_info$is_correlation) {
# correlation test
out <- .report_table_correlation(table_full)
} else {
out <- list(table_full = table_full, table = NULL)
}

# Return output

as.report_table(out$table_full, summary = out$table, effsize = effsize)
}

Expand All @@ -152,7 +172,10 @@ report_statistics.htest <- function(x, table = NULL, ...) {
text <- NULL

# Estimate
candidates <- c("rho", "r", "tau", "Difference", "r_rank_biserial")
candidates <- c(
"rho", "r", "tau", "Difference", "r_rank_biserial",
"Chi2", "Odds Ratio"
)
estimate <- candidates[candidates %in% names(table)][1]
if (!is.null(estimate) && !is.na(estimate)) {
text <- paste0(tolower(estimate), " = ", insight::format_value(table[[estimate]]))
Expand Down Expand Up @@ -186,15 +209,14 @@ report_statistics.htest <- function(x, table = NULL, ...) {
text <- paste0(text, ", z = ", insight::format_value(table$z))
} else if ("W" %in% names(table)) {
text <- paste0("W = ", insight::format_value(table$W))
} else if ("Chi2" %in% names(table)) {
text <- paste0(text, ", Chi2 = ", insight::format_value(table$Chi2))
}

# p-value
text <- paste0(text, ", ", insight::format_p(table$p, stars = FALSE, digits = "apa"))

# Effect size
if (model_info$is_ttest || (model_info$is_ranktest && !model_info$is_correlation)) {
if (model_info$is_ttest || (model_info$is_ranktest && !model_info$is_correlation) ||
model_info$is_chi2test) {
text_full <- paste0(text, "; ", attributes(effsize)$statistics)
text <- paste0(text, ", ", attributes(effsize)$main)
} else {
Expand Down Expand Up @@ -239,13 +261,29 @@ report_parameters.htest <- function(x, table = NULL, ...) {
# Correlations
if (model_info$is_correlation) {
out <- .report_parameters_correlation(table, stats, ...)

# t-tests
} else if (model_info$is_ttest) {
out <- .report_parameters_ttest(table, stats, effsize, ...)

# TODO: default, same as t-test?
# Friedman
} else if (
model_info$is_ranktest &&
grepl("Friedman", attributes(x$statistic)$names, fixed = TRUE)) {
out <- .report_parameters_friedman(table, stats, effsize, ...)
} else if (!is.null(x$statistic) && grepl(
"Kruskal", attributes(x$statistic)$names,
fixed = TRUE
)) {
# Kruskal
out <- .report_parameters_kruskal(table, stats, effsize, ...)
# chi2
} else if (model_info$is_chi2test) {
if (chi2_type(x) == "fisher") {
out <- .report_parameters_fisher(table, stats, effsize, ...)
} else {
out <- .report_parameters_chi2(table, stats, effsize, ...)
}
} else {
# TODO: default, same as t-test?
out <- .report_parameters_htest_default(table, stats, effsize, ...)
}

Expand Down Expand Up @@ -286,7 +324,23 @@ report_model.htest <- function(x, table = NULL, ...) {
}

if (model_info$is_ranktest && !model_info$is_correlation) {
text <- .report_model_wilcox(x, table)
# For friedman test ---------------

if (grepl("Friedman", attributes(x$statistic)$names, fixed = TRUE)) {
text <- .report_model_friedman(x, table)
} else {
# For wilcox test ---------------

text <- .report_model_wilcox(x, table)
}
}

if (model_info$is_chi2test) {
if (chi2_type(x) == "fisher") {
text <- .report_model_fisher(x, table)
} else {
text <- .report_model_chi2(x, table)
}
}

as.report_model(text, summary = text)
Expand Down
7 changes: 2 additions & 5 deletions R/report.lm.R
Original file line number Diff line number Diff line change
Expand Up @@ -99,21 +99,18 @@ report_effectsize.lm <- function(x, effectsize_method = "refit", ...) {

if ("Component" %in% colnames(table)) {
merge_by <- c("Parameter", "Component")
start_col <- 4
start_col <- 4L
} else {
merge_by <- "Parameter"
start_col <- 3
start_col <- 3L
}

table <- as.data.frame(table)[c(merge_by, estimate, "CI_low", "CI_high")]
names(table)[start_col:ncol(table)] <- c(paste0(estimate, "_CI_low"), paste0(estimate, "_CI_high"))


rules <- .text_effectsize(attr(attr(interpret, "rules"), "rule_name"))
parameters <- paste0(interpretation, " (", statistics, ")")


# Return output
as.report_effectsize(parameters,
summary = parameters,
table = table,
Expand Down
18 changes: 9 additions & 9 deletions R/report.numeric.R
Original file line number Diff line number Diff line change
Expand Up @@ -206,15 +206,15 @@ report_parameters.numeric <- function(x,
}

text_full <- c(
"n_Obs" = text_n,
"Mean" = text_mean,
"Dispersion_Mean" = paste0("SD = ", text_sd),
"Median" = text_median,
"Dispersion_Median" = paste0("MAD = ", text_mad),
"Range" = paste0("range: ", text_range),
"Skewness" = text_skewness,
"Kurtosis" = text_kurtosis,
"Missing" = text_missing
n_Obs = text_n,
Mean = text_mean,
Dispersion_Mean = paste0("SD = ", text_sd),
Median = text_median,
Dispersion_Median = paste0("MAD = ", text_mad),
Range = paste0("range: ", text_range),
Skewness = text_skewness,
Kurtosis = text_kurtosis,
Missing = text_missing
)

# Shorten ---
Expand Down
6 changes: 3 additions & 3 deletions R/report.sessionInfo.R
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@ report_table.sessionInfo <- function(x, include_R = TRUE, ...) {
}

data <- data.frame(
"Package" = names,
"Version" = versions,
"Reference" = citations,
Package = names,
Version = versions,
Reference = citations,
stringsAsFactors = FALSE
)

Expand Down
Loading

0 comments on commit 071fcab

Please sign in to comment.