Skip to content

Commit

Permalink
docs, option
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Mar 13, 2024
1 parent e1f85dd commit e05fb33
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
18 changes: 11 additions & 7 deletions R/print.parameters_model.R
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@
#' default for the `select` argument. See argument's documentation for available
#' options.
#'
#' - `easystats_html_engine`: `options(easystats_html_engine = "gt")` will set
#' the default HTML engine for tables to `gt`, i.e. the _gt_ package is used to
#' create HTML tables. If set to `tt`, the _tinytable_ package is used.
#'
#' @details `summary()` is a convenient shortcut for
#' `print(object, select = "minimal", show_sigma = TRUE, show_formula = TRUE)`.
#'
Expand Down Expand Up @@ -412,7 +416,7 @@ print.parameters_random <- function(x, digits = 2, ...) {
show_formula = FALSE,
format = "text") {
# get attributes
sigma <- attributes(x)$sigma
model_sigma <- attributes(x)$sigma
show_summary <- isTRUE(attributes(x)$show_summary)
verbose <- .additional_arguments(x, "verbose", TRUE)

Expand All @@ -423,7 +427,7 @@ print.parameters_random <- function(x, digits = 2, ...) {
show_r2 <- .additional_arguments(x, "show_summary", FALSE)

# set defaults, if necessary
if (is.null(sigma)) {
if (is.null(model_sigma)) {
show_sigma <- FALSE
}

Expand Down Expand Up @@ -522,10 +526,10 @@ print.parameters_random <- function(x, digits = 2, ...) {
random_params$Term[is.na(random_params$Term)] <- ""
random_params$SD[is.na(random_params$SD)] <- ""

non_empty <- random_params$Term != "" & random_params$Type != ""
non_empty <- random_params$Term != "" & random_params$Type != "" # nolint
random_params$Line[non_empty] <- sprintf("%s (%s)", random_params$Type[non_empty], random_params$Term[non_empty])

non_empty <- random_params$Term != "" & random_params$Type == ""
non_empty <- random_params$Term != "" & random_params$Type == "" # nolint
random_params$Line[non_empty] <- sprintf("%s", random_params$Term[non_empty])

# final fix, indentions
Expand Down Expand Up @@ -567,9 +571,9 @@ print.parameters_random <- function(x, digits = 2, ...) {
col_width <- rep(NA, length(shared_cols))
for (i in seq_along(shared_cols)) {
col_width[i] <- max(unlist(lapply(formatted_table, function(j) {
col <- j[[shared_cols[i]]]
if (!is.null(col)) {
max(nchar(col))
column <- j[[shared_cols[i]]]
if (!is.null(column)) {
max(nchar(column))
} else {
NA
}
Expand Down
2 changes: 1 addition & 1 deletion R/print_html.R
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ print_html.compare_parameters <- function(x,
}

# markdown engine?
engine <- match.arg(engine, c("gt", "default", "tt"))
engine <- match.arg(getOption("easystats_html_engine", engine), c("gt", "default", "tt"))

# for tiny table, we can just call print_md()
if (engine == "tt") {
Expand Down
3 changes: 3 additions & 0 deletions man/model_parameters.Rd

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

3 changes: 3 additions & 0 deletions man/print.parameters_model.Rd

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

0 comments on commit e05fb33

Please sign in to comment.