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
Examples
log_formatter(formatter_pander)
log_info("42")
#> INFO [2026-01-06 21:43:01] 42
log_info(42)
#> INFO [2026-01-06 21:43:01] _42_
log_info(4 + 2)
#> INFO [2026-01-06 21:43:01] _6_
log_info(head(iris))
#> INFO [2026-01-06 21:43:01]
#> INFO [2026-01-06 21:43:01] -------------------------------------------------------------------
#> INFO [2026-01-06 21:43:01] Sepal.Length Sepal.Width Petal.Length Petal.Width Species
#> INFO [2026-01-06 21:43:01] -------------- ------------- -------------- ------------- ---------
#> INFO [2026-01-06 21:43:01] 5.1 3.5 1.4 0.2 setosa
#> INFO [2026-01-06 21:43:01]
#> INFO [2026-01-06 21:43:01] 4.9 3 1.4 0.2 setosa
#> INFO [2026-01-06 21:43:01]
#> INFO [2026-01-06 21:43:01] 4.7 3.2 1.3 0.2 setosa
#> INFO [2026-01-06 21:43:01]
#> INFO [2026-01-06 21:43:01] 4.6 3.1 1.5 0.2 setosa
#> INFO [2026-01-06 21:43:01]
#> INFO [2026-01-06 21:43:01] 5 3.6 1.4 0.2 setosa
#> INFO [2026-01-06 21:43:01]
#> INFO [2026-01-06 21:43:01] 5.4 3.9 1.7 0.4 setosa
#> INFO [2026-01-06 21:43:01] -------------------------------------------------------------------
#> INFO [2026-01-06 21:43:01]
log_info(head(iris), style = "simple")
#> INFO [2026-01-06 21:43:01]
#> INFO [2026-01-06 21:43:01]
#> INFO [2026-01-06 21:43:01] Sepal.Length Sepal.Width Petal.Length Petal.Width Species
#> INFO [2026-01-06 21:43:01] -------------- ------------- -------------- ------------- ---------
#> INFO [2026-01-06 21:43:01] 5.1 3.5 1.4 0.2 setosa
#> INFO [2026-01-06 21:43:01] 4.9 3 1.4 0.2 setosa
#> INFO [2026-01-06 21:43:01] 4.7 3.2 1.3 0.2 setosa
#> INFO [2026-01-06 21:43:01] 4.6 3.1 1.5 0.2 setosa
#> INFO [2026-01-06 21:43:01] 5 3.6 1.4 0.2 setosa
#> INFO [2026-01-06 21:43:01] 5.4 3.9 1.7 0.4 setosa
#> INFO [2026-01-06 21:43:01]
log_info(lm(hp ~ wt, mtcars))
#> INFO [2026-01-06 21:43:01]
#> INFO [2026-01-06 21:43:01] ----------------------------------------------------------------
#> INFO [2026-01-06 21:43:01] Estimate Std. Error t value Pr(>|t|)
#> INFO [2026-01-06 21:43:01] ----------------- ---------- ------------ ---------- -----------
#> INFO [2026-01-06 21:43:01] **(Intercept)** -1.821 32.32 -0.05633 0.9555
#> INFO [2026-01-06 21:43:01]
#> INFO [2026-01-06 21:43:01] **wt** 46.16 9.625 4.796 4.146e-05
#> INFO [2026-01-06 21:43:01] ----------------------------------------------------------------
#> INFO [2026-01-06 21:43:01]
#> INFO [2026-01-06 21:43:01] Table: Fitting linear model: hp ~ wt
#> INFO [2026-01-06 21:43:01]
