Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .lintr
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
linters: all_linters(
coalesce_linter = NULL,
absolute_path_linter = NULL,
cyclocomp_linter(40L),
if_not_else_linter(exceptions = character(0L)),
indentation_linter = NULL,
implicit_integer_linter = NULL,
library_call_linter = NULL,
line_length_linter(120L),
namespace_linter = NULL,
nonportable_path_linter = NULL,
object_length_linter(50L),
object_name_linter = NULL,
object_usage_linter = NULL,
one_call_pipe_linter = NULL,
todo_comment_linter = NULL,
commented_code_linter = NULL,
undesirable_function_linter(c("mapply" = NA, "setwd" = NA)),
undesirable_operator_linter = NULL,
unnecessary_concatenation_linter(allow_single_expression = FALSE),
unused_import_linter = NULL
)
exclusions: list()
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# report 0.6.x

Bug fixes
Bug fixes

* Fixed a lot of linting issues across the package.
* Fixed duplicated text output in `report()` for glmmTMB objects by addressing both regex pattern and redundant CI information concatenation in `report_info.lm()` (#481)
Expand Down
28 changes: 14 additions & 14 deletions R/report.factor.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ report.factor <- function(x, levels_percentage = "auto", ...) {
if (!is.factor(x)) {
x <- as.factor(x)
}
table <- report_table(x, levels_percentage = levels_percentage, ...)
text <- report_text(x, levels_percentage = levels_percentage, ...)
report_table_obj <- report_table(x, levels_percentage = levels_percentage, ...)
report_text_obj <- report_text(x, levels_percentage = levels_percentage, ...)

as.report(text, table = table, ...)
as.report(report_text_obj, table = report_table_obj, ...)
}

#' @export
Expand Down Expand Up @@ -37,12 +37,12 @@ report_table.factor <- function(x, levels_percentage = "auto", ...) {
table_full$percentage_Obs <- table_full$n_Obs / length(x) * 100

# Shorten
table <- table_full
report_table_obj <- table_full
if (!levels_percentage) {
table <- datawizard::data_remove(table, "percentage_Obs")
report_table_obj <- datawizard::data_remove(report_table_obj, "percentage_Obs")
}

as.report_table(table_full, summary = table)
as.report_table(table_full, summary = report_table_obj)
}

#' @export
Expand Down Expand Up @@ -76,18 +76,18 @@ report_parameters.factor <- function(x, table = NULL, levels_percentage = "auto"
)

if (isTRUE(levels_percentage)) {
text <- paste0(
report_text_obj <- paste0(
text_levels, " (",
text_percentage_Obs, ")"
)
} else {
text <- paste0(
report_text_obj <- paste0(
text_levels, " (",
text_n_Obs, ")"
)
}

as.report_parameters(text_full, summary = text, ...)
as.report_parameters(text_full, summary = report_text_obj, ...)
}

#' @export
Expand Down Expand Up @@ -126,9 +126,9 @@ report_text.factor <- function(x, table = NULL, levels_percentage = "auto", ...)
}

text_full <- paste0(text_total_levels, datawizard::text_concatenate(params, sep = ", "))
text <- paste0(text_total_levels, datawizard::text_concatenate(summary(params), sep = ", "))
report_text_obj <- paste0(text_total_levels, datawizard::text_concatenate(summary(params), sep = ", "))

as.report_text(text_full, summary = text)
as.report_text(text_full, summary = report_text_obj)
}

#' @export
Expand Down Expand Up @@ -161,18 +161,18 @@ report_statistics.factor <- function(x, table = NULL, levels_percentage = "auto"
)

if (isTRUE(levels_percentage)) {
text <- paste0(
report_text_obj <- paste0(
text_levels, ", ",
text_percentage_Obs
)
} else {
text <- paste0(
report_text_obj <- paste0(
text_levels, ", ",
text_n_Obs
)
}

as.report_statistics(paste(text_full, collapse = "; "), summary = paste(text, collapse = "; "))
as.report_statistics(paste(text_full, collapse = "; "), summary = paste(report_text_obj, collapse = "; "))
}

#' @export
Expand Down
Loading