diff --git a/NAMESPACE b/NAMESPACE index 0922d74f..7280d0b5 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -21,9 +21,9 @@ S3method(print,report_parameters) S3method(print,report_performance) S3method(print,report_priors) S3method(print,report_random) +S3method(print,report_sample) S3method(print,report_statistics) S3method(print,report_table) -S3method(print,report_table1) S3method(print,report_text) S3method(report,MixMod) S3method(report,anova) diff --git a/R/cite_easystats.R b/R/cite_easystats.R index 78213b4a..9c747f33 100644 --- a/R/cite_easystats.R +++ b/R/cite_easystats.R @@ -7,7 +7,7 @@ #' summary(cite_easystats()) #' as.data.frame(cite_easystats()) #' -#' @return An object of class \code{cite_easystats} that can be printed, summarised (using \code{summary()}), or transformed into a table (using \code{as.data.frame()}). +#' @return An object of class \code{cite_easystats} that can be printed, summarized (using \code{summary()}), or transformed into a table (using \code{as.data.frame()}). #' #' @export cite_easystats <- function() { diff --git a/R/report.brmsfit.R b/R/report.brmsfit.R index d6bfb411..0aeb06a9 100644 --- a/R/report.brmsfit.R +++ b/R/report.brmsfit.R @@ -11,7 +11,7 @@ #' library(report) #' #' # Bayesian models -#' \donttest{ +#' \dontrun{ #' if (require("brms")) { #' model <- brm(mpg ~ qsec + wt, data = mtcars, refresh = 0, iter = 300) #' r <- report(model) diff --git a/R/report.compare_performance.R b/R/report.compare_performance.R index 0411c704..41de7823 100644 --- a/R/report.compare_performance.R +++ b/R/report.compare_performance.R @@ -12,24 +12,23 @@ #' #' @examples #' library(report) +#' library(performance) #' #' m1 <- lm(Sepal.Length ~ Petal.Length * Species, data = iris) #' m2 <- lm(Sepal.Length ~ Petal.Length + Species, data = iris) #' m3 <- lm(Sepal.Length ~ Petal.Length, data = iris) #' -#' if (require("performance")) { -#' x <- performance::compare_performance(m1, m2, m3) -#' r <- report(x) -#' r -#' summary(r) -#' as.data.frame(r) -#' summary(as.data.frame(r)) +#' x <- performance::compare_performance(m1, m2, m3) +#' r <- report(x) +#' r +#' summary(r) +#' as.data.frame(r) +#' summary(as.data.frame(r)) #' -#' # Specific reports -#' report_table(x) -#' report_statistics(x) -#' report_parameters(x) -#' } +#' # Specific reports +#' report_table(x) +#' report_statistics(x) +#' report_parameters(x) #' @return An object of class \code{\link{report}}. #' @export report.compare_performance <- function(x, ...) { diff --git a/R/report.stanreg.R b/R/report.stanreg.R index 89af2267..568cb30a 100644 --- a/R/report.stanreg.R +++ b/R/report.stanreg.R @@ -13,7 +13,7 @@ #' \donttest{ #' # Bayesian models #' if (require("rstanarm")) { -#' model <- stan_glm(mpg ~ qsec + wt, data = mtcars, refresh = 0) +#' model <- stan_glm(mpg ~ qsec + wt, data = mtcars, refresh = 0, iter = 500) #' r <- report(model) #' r #' summary(r) diff --git a/R/report_effectsize.R b/R/report_effectsize.R index f3cd07a7..e02e2480 100644 --- a/R/report_effectsize.R +++ b/R/report_effectsize.R @@ -8,7 +8,7 @@ #' @inheritParams report_text #' @inheritParams as.report #' -#' @return An object of class \code{report_effectsize}. +#' @return An object of class \code{\link{report_effectsize}}. #' #' @examples #' library(report) diff --git a/R/report_info.R b/R/report_info.R index a7d63eef..d3af7fef 100644 --- a/R/report_info.R +++ b/R/report_info.R @@ -8,7 +8,7 @@ #' @inheritParams report_text #' @inheritParams as.report #' -#' @return A \code{character} string. +#' @return An object of class \code{\link{report_info}}. #' #' @examples #' library(report) diff --git a/R/report_intecept.R b/R/report_intecept.R index 0145c96a..8b146a80 100644 --- a/R/report_intecept.R +++ b/R/report_intecept.R @@ -7,7 +7,7 @@ #' @inheritParams report_text #' @inheritParams as.report #' -#' @return A \code{character} string. +#' @return An object of class \code{\link{report_intercept}}. #' #' @examples #' library(report) diff --git a/R/report_misc.R b/R/report_misc.R index 7c63f356..29462589 100644 --- a/R/report_misc.R +++ b/R/report_misc.R @@ -12,6 +12,8 @@ #' report_date() #' summary(report_date()) #' report_story() +#' +#' @return Objects of class \code{\link{report_text}}. #' @export report_date <- function(...) { date <- Sys.time() diff --git a/R/report_performance.R b/R/report_performance.R index e93f4f2b..8d748be1 100644 --- a/R/report_performance.R +++ b/R/report_performance.R @@ -11,7 +11,7 @@ #' @inheritParams report_text #' @inheritParams as.report #' -#' @return A \code{character} string. +#' @return An object of class \code{\link{report_performance}}. #' #' @examples #' library(report) diff --git a/R/report_priors.R b/R/report_priors.R index 3c0757b5..2f1cdcc9 100644 --- a/R/report_priors.R +++ b/R/report_priors.R @@ -8,7 +8,7 @@ #' @inheritParams report_text #' @inheritParams as.report #' -#' @return A \code{character} string. +#' @return An object of class \code{\link{report_priors}}. #' #' @examples #' library(report) diff --git a/R/report_random.R b/R/report_random.R index dda33ea4..7826bbb8 100644 --- a/R/report_random.R +++ b/R/report_random.R @@ -8,7 +8,7 @@ #' @inheritParams report_text #' @inheritParams as.report #' -#' @return A \code{character} string. +#' @return An object of class \code{\link{report_random}}. #' #' @examples #' library(report) @@ -30,7 +30,7 @@ #' summary(r) #' } #' } -#' \donttest{ +#' \dontrun{ #' if (require("brms")) { #' model <- brm(mpg ~ disp + (1 | cyl), data = mtcars, refresh = 0, iter = 1000) #' r <- report_random(model) diff --git a/R/report_sample.R b/R/report_sample.R index b39aa35b..517a779d 100644 --- a/R/report_sample.R +++ b/R/report_sample.R @@ -20,7 +20,7 @@ #' @param digits Number of decimals. #' @inheritParams report.data.frame #' -#' @return A data frame of class \code{report_table1} with variable names and +#' @return A data frame of class \code{report_sample} with variable names and #' their related summary statistics. #' #' @examples @@ -88,7 +88,7 @@ report_sample <- function(data, } - class(out) <- c("report_table1", class(out)) + class(out) <- c("report_sample", class(out)) out } @@ -110,7 +110,7 @@ report_sample <- function(data, } do.call(rbind, lapply(columns, function(cn) { - .table1_row( + .report_sample_row( x[[cn]], column = cn, centrality = centrality, @@ -128,13 +128,13 @@ report_sample <- function(data, # create a "table row", i.e. a summary from a variable ------------------------ -.table1_row <- function(x, digits = 1, ...) { - UseMethod(".table1_row") +.report_sample_row <- function(x, digits = 1, ...) { + UseMethod(".report_sample_row") } -.table1_row.numeric <- function(x, +.report_sample_row.numeric <- function(x, column, centrality = "mean", weights = NULL, @@ -162,7 +162,7 @@ report_sample <- function(data, #' @importFrom stats na.omit xtabs -.table1_row.factor <- function(x, column, weights = NULL, digits = 1, ...) { +.report_sample_row.factor <- function(x, column, weights = NULL, digits = 1, ...) { if (!is.null(weights)) { x[is.na(weights)] <- NA weights[is.na(x)] <- NA @@ -186,7 +186,7 @@ report_sample <- function(data, } -.table1_row.character <- .table1_row.factor +.report_sample_row.character <- .report_sample_row.factor @@ -195,7 +195,7 @@ report_sample <- function(data, #' @importFrom insight print_colour export_table #' @export -print.report_table1 <- function(x, ...) { +print.report_sample <- function(x, ...) { insight::print_colour("# Descriptive Statistics\n\n", "blue") cat(insight::export_table(x)) } diff --git a/R/report_statistics.R b/R/report_statistics.R index 24792e91..1d42b79d 100644 --- a/R/report_statistics.R +++ b/R/report_statistics.R @@ -9,7 +9,7 @@ #' @inheritParams report_text #' @inheritParams as.report #' -#' @return A \code{vector}. +#' @return An object of class \code{\link{report_statistics}}. #' #' @examples #' library(report) diff --git a/R/report_table.R b/R/report_table.R index 3af41904..9f5f5cc4 100644 --- a/R/report_table.R +++ b/R/report_table.R @@ -5,7 +5,7 @@ #' #' @inheritParams report #' -#' @return A \code{data.frame}. +#' @return An object of class \code{\link{report_table}}. #' #' @examples #' library(report) diff --git a/R/report_text.R b/R/report_text.R index 69d91e32..a318a838 100644 --- a/R/report_text.R +++ b/R/report_text.R @@ -8,7 +8,7 @@ #' @param table A table obtained via \code{report_table()}. If not provided, #' will run it. #' -#' @return A \code{character} string. +#' @return An object of class \code{\link{report_text}}. #' #' @examples #' library(report) diff --git a/man/cite_easystats.Rd b/man/cite_easystats.Rd index 5f5555e8..f810e12f 100644 --- a/man/cite_easystats.Rd +++ b/man/cite_easystats.Rd @@ -7,7 +7,7 @@ cite_easystats() } \value{ -An object of class \code{cite_easystats} that can be printed, summarised (using \code{summary()}), or transformed into a table (using \code{as.data.frame()}). +An object of class \code{cite_easystats} that can be printed, summarized (using \code{summary()}), or transformed into a table (using \code{as.data.frame()}). } \description{ A convenient function for those who wish to cite the easystats packages. diff --git a/man/report.brmsfit.Rd b/man/report.brmsfit.Rd index c6d393b4..c7273ca9 100644 --- a/man/report.brmsfit.Rd +++ b/man/report.brmsfit.Rd @@ -23,7 +23,7 @@ follows the Sequential Effect eXistence and sIgnificance Testing framework library(report) # Bayesian models -\donttest{ +\dontrun{ if (require("brms")) { model <- brm(mpg ~ qsec + wt, data = mtcars, refresh = 0, iter = 300) r <- report(model) diff --git a/man/report.compare_performance.Rd b/man/report.compare_performance.Rd index bd5c20ed..972cfb09 100644 --- a/man/report.compare_performance.Rd +++ b/man/report.compare_performance.Rd @@ -36,24 +36,23 @@ function in the \code{performance} package. } \examples{ library(report) +library(performance) m1 <- lm(Sepal.Length ~ Petal.Length * Species, data = iris) m2 <- lm(Sepal.Length ~ Petal.Length + Species, data = iris) m3 <- lm(Sepal.Length ~ Petal.Length, data = iris) -if (require("performance")) { - x <- performance::compare_performance(m1, m2, m3) - r <- report(x) - r - summary(r) - as.data.frame(r) - summary(as.data.frame(r)) +x <- performance::compare_performance(m1, m2, m3) +r <- report(x) +r +summary(r) +as.data.frame(r) +summary(as.data.frame(r)) - # Specific reports - report_table(x) - report_statistics(x) - report_parameters(x) -} +# Specific reports +report_table(x) +report_statistics(x) +report_parameters(x) } \seealso{ Specific components of reports (especially for stats models): diff --git a/man/report.stanreg.Rd b/man/report.stanreg.Rd index 32b55a61..4f130cf4 100644 --- a/man/report.stanreg.Rd +++ b/man/report.stanreg.Rd @@ -25,7 +25,7 @@ library(report) \donttest{ # Bayesian models if (require("rstanarm")) { - model <- stan_glm(mpg ~ qsec + wt, data = mtcars, refresh = 0) + model <- stan_glm(mpg ~ qsec + wt, data = mtcars, refresh = 0, iter = 500) r <- report(model) r summary(r) diff --git a/man/report_date.Rd b/man/report_date.Rd index bcd6942c..70a1f4b2 100644 --- a/man/report_date.Rd +++ b/man/report_date.Rd @@ -13,9 +13,7 @@ report_story(...) \item{...}{Arguments passed to or from other methods.} } \value{ -A list-object of class \code{report}, which contains further - list-objects with a short and long description of the model summary, as - well as a short and long table of parameters and fit indices. +Objects of class \code{\link{report_text}}. } \description{ Other convenient or totally useless reports. @@ -26,6 +24,7 @@ library(report) report_date() summary(report_date()) report_story() + } \seealso{ Specific components of reports (especially for stats models): diff --git a/man/report_effectsize.Rd b/man/report_effectsize.Rd index 96ad74d2..501f73dd 100644 --- a/man/report_effectsize.Rd +++ b/man/report_effectsize.Rd @@ -13,7 +13,7 @@ objects above).} \item{...}{Arguments passed to or from other methods.} } \value{ -An object of class \code{report_effectsize}. +An object of class \code{\link{report_effectsize}}. } \description{ Computes, interpret and formats the effect sizes of a variety of models and diff --git a/man/report_info.Rd b/man/report_info.Rd index d02758c2..a370bb66 100644 --- a/man/report_info.Rd +++ b/man/report_info.Rd @@ -13,7 +13,7 @@ objects above).} \item{...}{Arguments passed to or from other methods.} } \value{ -A \code{character} string. +An object of class \code{\link{report_info}}. } \description{ Reports additional information relevant to the report (see list of supported diff --git a/man/report_intercept.Rd b/man/report_intercept.Rd index 592798ca..46d36a6b 100644 --- a/man/report_intercept.Rd +++ b/man/report_intercept.Rd @@ -13,7 +13,7 @@ objects above).} \item{...}{Arguments passed to or from other methods.} } \value{ -A \code{character} string. +An object of class \code{\link{report_intercept}}. } \description{ Reports intercept of regression models (see list of supported objects in \code{\link{report}}). diff --git a/man/report_performance.Rd b/man/report_performance.Rd index 9964fadd..aa8e068a 100644 --- a/man/report_performance.Rd +++ b/man/report_performance.Rd @@ -16,7 +16,7 @@ will run it.} \item{...}{Arguments passed to or from other methods.} } \value{ -A \code{character} string. +An object of class \code{\link{report_performance}}. } \description{ Investigating the fit of statistical models to data often involves selecting diff --git a/man/report_priors.Rd b/man/report_priors.Rd index bb988b61..c0b735b6 100644 --- a/man/report_priors.Rd +++ b/man/report_priors.Rd @@ -13,7 +13,7 @@ objects above).} \item{...}{Arguments passed to or from other methods.} } \value{ -A \code{character} string. +An object of class \code{\link{report_priors}}. } \description{ Reports priors of Bayesian models (see list of supported objects in diff --git a/man/report_random.Rd b/man/report_random.Rd index 1e674cb4..2602b7bd 100644 --- a/man/report_random.Rd +++ b/man/report_random.Rd @@ -13,7 +13,7 @@ objects above).} \item{...}{Arguments passed to or from other methods.} } \value{ -A \code{character} string. +An object of class \code{\link{report_random}}. } \description{ Reports random effects of mixed models (see list of supported objects in @@ -39,7 +39,7 @@ if (require("rstanarm")) { summary(r) } } -\donttest{ +\dontrun{ if (require("brms")) { model <- brm(mpg ~ disp + (1 | cyl), data = mtcars, refresh = 0, iter = 1000) r <- report_random(model) diff --git a/man/report_sample.Rd b/man/report_sample.Rd index 6a1f95c0..a632b4c5 100644 --- a/man/report_sample.Rd +++ b/man/report_sample.Rd @@ -44,7 +44,7 @@ weight-variable. Reported descriptive statistics will be weighted by \item{...}{Arguments passed to or from other methods.} } \value{ -A data frame of class \code{report_table1} with variable names and +A data frame of class \code{report_sample} with variable names and their related summary statistics. } \description{ diff --git a/man/report_statistics.Rd b/man/report_statistics.Rd index 959f5882..c0d35be5 100644 --- a/man/report_statistics.Rd +++ b/man/report_statistics.Rd @@ -16,7 +16,7 @@ will run it.} \item{...}{Arguments passed to or from other methods.} } \value{ -A \code{vector}. +An object of class \code{\link{report_statistics}}. } \description{ Creates a list containing a description of the parameters' values of R diff --git a/man/report_table.Rd b/man/report_table.Rd index 6550e896..db8ef211 100644 --- a/man/report_table.Rd +++ b/man/report_table.Rd @@ -13,7 +13,7 @@ objects above).} \item{...}{Arguments passed to or from other methods.} } \value{ -A \code{data.frame}. +An object of class \code{\link{report_table}}. } \description{ Creates tables to describe different objects (see list of supported objects diff --git a/man/report_text.Rd b/man/report_text.Rd index d0773106..40e0895f 100644 --- a/man/report_text.Rd +++ b/man/report_text.Rd @@ -16,7 +16,7 @@ will run it.} \item{...}{Arguments passed to or from other methods.} } \value{ -A \code{character} string. +An object of class \code{\link{report_text}}. } \description{ Creates text containing a description of the parameters of R objects (see