-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1ec23a1
commit 2e18d27
Showing
1 changed file
with
14 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,14 @@ | ||
.onLoad <- function(libname, pkgname){ | ||
pkgs <- c("kableExtra", "gt", "flextable", "huxtable", "DT") | ||
flags <- insight::check_if_installed(pkgs, quietly = TRUE) | ||
if (!any(flags) && !isTRUE(config_get("factory_default") == "markdown")) { | ||
msg <- c( | ||
'`modelsummary` has built-in support to draw text-only (markdown) tables. To generate tables in other formats, you must install one or more of these libraries:', | ||
' | ||
install.packages(c( | ||
"kableExtra", | ||
"gt", | ||
"flextable", | ||
"huxtable", | ||
"DT" | ||
)) | ||
', | ||
'Alternatively, you can set markdown as the default table format to silence this alert:', | ||
' | ||
config_modelsummary(factory_default = "markdown") | ||
') | ||
insight::format_alert(msg) | ||
} | ||
} | ||
.onAttach <- function(libname, pkgname){ | ||
msg <- insight::format_message( | ||
"Version 2.0.0 of `modelsummary`, to be released soon, will introduce a breaking change: The default table-drawing package will be `tinytable` instead of `kableExtra`. All currently supported table-drawing packages will continue to be supported for the foreseeable future, including `kableExtra`, `gt`, `huxtable`, `flextable, and `DT`.", | ||
"", | ||
"You can always call the `config_modelsummary()` function to change the default table-drawing package in persistent fashion. To try `tinytable` now:", | ||
"", | ||
"config_modelsummary(factory_default = 'tinytable')", | ||
"", | ||
"To set the default back to `kableExtra`:", | ||
"", | ||
"config_modelsummary(factory_default = 'kableExtra')" | ||
) | ||
packageStartupMessage(msg) | ||
} |