Formats R objects with pander
formatter_pander(
x,
...,
.logcall = sys.call(),
.topcall = sys.call(-1),
.topenv = parent.frame()
)object to be logged
optional parameters passed to pander
the logging call being evaluated (useful in formatters and layouts when you want to have access to the raw, unevaluated R expression)
R expression from which the logging function was called (useful in formatters and layouts to extract the calling function's name or arguments)
original frame of the .topcall calling function
where the formatter function will be evaluated and that is used
to look up the namespace as well via logger:::top_env_name
character vector
This functionality depends on the pander package.
Other log_formatters:
formatter_cli(),
formatter_glue(),
formatter_glue_or_sprintf(),
formatter_glue_safe(),
formatter_json(),
formatter_logging(),
formatter_paste(),
formatter_sprintf()
log_formatter(formatter_pander)
log_info("42")
#> INFO [2025-09-17 13:55:07] 42
log_info(42)
#> INFO [2025-09-17 13:55:07] _42_
log_info(4 + 2)
#> INFO [2025-09-17 13:55:07] _6_
log_info(head(iris))
#> INFO [2025-09-17 13:55:07]
#> INFO [2025-09-17 13:55:07] -------------------------------------------------------------------
#> INFO [2025-09-17 13:55:07] Sepal.Length Sepal.Width Petal.Length Petal.Width Species
#> INFO [2025-09-17 13:55:07] -------------- ------------- -------------- ------------- ---------
#> INFO [2025-09-17 13:55:07] 5.1 3.5 1.4 0.2 setosa
#> INFO [2025-09-17 13:55:07]
#> INFO [2025-09-17 13:55:07] 4.9 3 1.4 0.2 setosa
#> INFO [2025-09-17 13:55:07]
#> INFO [2025-09-17 13:55:07] 4.7 3.2 1.3 0.2 setosa
#> INFO [2025-09-17 13:55:07]
#> INFO [2025-09-17 13:55:07] 4.6 3.1 1.5 0.2 setosa
#> INFO [2025-09-17 13:55:07]
#> INFO [2025-09-17 13:55:07] 5 3.6 1.4 0.2 setosa
#> INFO [2025-09-17 13:55:07]
#> INFO [2025-09-17 13:55:07] 5.4 3.9 1.7 0.4 setosa
#> INFO [2025-09-17 13:55:07] -------------------------------------------------------------------
#> INFO [2025-09-17 13:55:07]
log_info(head(iris), style = "simple")
#> INFO [2025-09-17 13:55:07]
#> INFO [2025-09-17 13:55:07]
#> INFO [2025-09-17 13:55:07] Sepal.Length Sepal.Width Petal.Length Petal.Width Species
#> INFO [2025-09-17 13:55:07] -------------- ------------- -------------- ------------- ---------
#> INFO [2025-09-17 13:55:07] 5.1 3.5 1.4 0.2 setosa
#> INFO [2025-09-17 13:55:07] 4.9 3 1.4 0.2 setosa
#> INFO [2025-09-17 13:55:07] 4.7 3.2 1.3 0.2 setosa
#> INFO [2025-09-17 13:55:07] 4.6 3.1 1.5 0.2 setosa
#> INFO [2025-09-17 13:55:07] 5 3.6 1.4 0.2 setosa
#> INFO [2025-09-17 13:55:07] 5.4 3.9 1.7 0.4 setosa
#> INFO [2025-09-17 13:55:07]
log_info(lm(hp ~ wt, mtcars))
#> INFO [2025-09-17 13:55:07]
#> INFO [2025-09-17 13:55:07] ----------------------------------------------------------------
#> INFO [2025-09-17 13:55:07] Estimate Std. Error t value Pr(>|t|)
#> INFO [2025-09-17 13:55:07] ----------------- ---------- ------------ ---------- -----------
#> INFO [2025-09-17 13:55:07] **(Intercept)** -1.821 32.32 -0.05633 0.9555
#> INFO [2025-09-17 13:55:07]
#> INFO [2025-09-17 13:55:07] **wt** 46.16 9.625 4.796 4.146e-05
#> INFO [2025-09-17 13:55:07] ----------------------------------------------------------------
#> INFO [2025-09-17 13:55:07]
#> INFO [2025-09-17 13:55:07] Table: Fitting linear model: hp ~ wt
#> INFO [2025-09-17 13:55:07]