Skip to content

Commit

Permalink
close #119
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Jan 6, 2021
1 parent 9b1951f commit dea2f08
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ importFrom(effectsize,interpret_oddsratio)
importFrom(effectsize,interpret_r)
importFrom(effectsize,interpret_rhat)
importFrom(effectsize,is_effectsize_name)
importFrom(insight,export_table)
importFrom(insight,find_algorithm)
importFrom(insight,find_variables)
importFrom(insight,format_bf)
Expand Down
4 changes: 2 additions & 2 deletions R/report_sample.R
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,11 @@ report_sample <- function(data, group_by = NULL, centrality = "mean", select = N
# print-method --------------------------------------------


#' @importFrom insight print_colour format_table
#' @importFrom insight print_colour export_table
#' @export
print.report_table1 <- function(x, ...) {
insight::print_colour("# Descriptive Statistics\n\n", "blue")
cat(insight::format_table(x))
cat(insight::export_table(x))
}


Expand Down
12 changes: 7 additions & 5 deletions R/report_table.R
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ as.report_table.default <- function(x, summary = NULL, ...) {

#' @export
as.report_table.report <- function(x, summary = NULL, ...) {
if (is.null(summary) | isFALSE(summary)) {
if (is.null(summary) || isFALSE(summary)) {
attributes(x)$table
} else if (isTRUE(summary)) {
summary(attributes(x)$table)
Expand All @@ -95,20 +95,22 @@ as.report_table.report <- function(x, summary = NULL, ...) {

#' @export
summary.report_table <- function(object, ...) {
if(is.null(attributes(object)$summary)){
if (is.null(attributes(object)$summary)) {
object
} else{
} else {
attributes(object)$summary
}
}


#' @importFrom insight format_table
#' @export
format.report_table <- function(x, ...) {
insight::parameters_table(x, ...)
insight::format_table(x, ...)
}

#' @importFrom insight export_table
#' @export
print.report_table <- function(x, ...) {
cat(insight::format_table(format(x, ...), ...))
cat(insight::export_table(format(x, ...), ...))
}

0 comments on commit dea2f08

Please sign in to comment.