inst/tinytest/test-datasummary_df.R

source("helpers.R")

tmp <- head(mtcars)

# no error + code coverage
tmp$cyl <- as.factor(tmp$cyl)

ar <- tail(mtcars, 1)
ac <- data.frame(new = 1:6)

tab <- datasummary_df(
  data = tmp,
  output = "default",
  fmt = "%.0f",
  align = strrep("r", ncol(tmp)),
  hrule = 3,
  title = "blah blah title",
  notes = c("first note", "second note"),
  add_rows = ar
)
expect_inherits(tab, "tinytable")

Try the modelsummary package in your browser

Any scripts or data that you put into this service are public.

modelsummary documentation built on June 8, 2025, 9:32 p.m.