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