Skip to content

Commit

Permalink
return statements (3)
Browse files Browse the repository at this point in the history
  • Loading branch information
DominiqueMakowski committed Apr 14, 2021
1 parent fe09f4d commit fedb54d
Show file tree
Hide file tree
Showing 31 changed files with 63 additions and 64 deletions.
2 changes: 1 addition & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion R/cite_easystats.R
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion R/report.brmsfit.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
23 changes: 11 additions & 12 deletions R/report.compare_performance.R
Original file line number Diff line number Diff line change
Expand Up @@ -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, ...) {
Expand Down
2 changes: 1 addition & 1 deletion R/report.stanreg.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion R/report_effectsize.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion R/report_info.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion R/report_intecept.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions R/report_misc.R
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion R/report_performance.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion R/report_priors.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions R/report_random.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
18 changes: 9 additions & 9 deletions R/report_sample.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -88,7 +88,7 @@ report_sample <- function(data,
}


class(out) <- c("report_table1", class(out))
class(out) <- c("report_sample", class(out))
out
}

Expand All @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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
Expand All @@ -186,7 +186,7 @@ report_sample <- function(data,
}


.table1_row.character <- .table1_row.factor
.report_sample_row.character <- .report_sample_row.factor



Expand All @@ -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))
}
Expand Down
2 changes: 1 addition & 1 deletion R/report_statistics.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion R/report_table.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#'
#' @inheritParams report
#'
#' @return A \code{data.frame}.
#' @return An object of class \code{\link{report_table}}.
#'
#' @examples
#' library(report)
Expand Down
2 changes: 1 addition & 1 deletion R/report_text.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion man/cite_easystats.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/report.brmsfit.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 11 additions & 12 deletions man/report.compare_performance.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/report.stanreg.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions man/report_date.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/report_effectsize.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/report_info.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/report_intercept.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/report_performance.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/report_priors.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/report_random.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/report_sample.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit fedb54d

Please sign in to comment.