tests/testthat/_snaps/format-tib.md

can format tib_unspecified()

Code
  tib_unspecified("a")
Output
  tib_unspecified("a")

format for scalars works

Code
  tib_chr("a")
Output
  tib_chr("a")
Code
  tib_date("a")
Output
  tib_date("a")
Code
  tib_dbl("a")
Output
  tib_dbl("a")
Code
  tib_int("a")
Output
  tib_int("a")
Code
  tib_lgl("a")
Output
  tib_lgl("a")
Code
  tib_variant("a")
Output
  tib_variant("a")
Code
  tib_int("a", .fill = NA_integer_)
Output
  tib_int("a")
Code
  tib_int("a", .fill = 1)
Output
  tib_int("a", .fill = 1L)
Code
  tib_int("a", .transform = as.integer)
Output
  tib_int("a", .transform = .Primitive("as.integer"))
Code
  tib_int("a", .fill = NA_integer_, .transform = as.integer)
Output
  tib_int("a", .transform = .Primitive("as.integer"))
Code
  tib_scalar("a", .ptype = new_difftime(units = "mins"))
Output
  tib_scalar("a", .ptype = vctrs::new_duration())
Code
  tib_row("a", x = tib_int("x"), y = tib_dbl("y", .fill = NA_real_), z = tib_chr(
    "z", .fill = "abc"))
Output
  tib_row(
    "a",
    tib_int("x"),
    tib_dbl("y"),
    tib_chr("z", .fill = "abc"),
  )
Code
  tib_int(.key = "x", .ptype_inner = character(), .fill = "a")
Output
  tib_int(
    "x",
    .fill = "a",
    .ptype_inner = character(0),
  )

format breaks long lines

Code
  print(tib_row("path", a_long_name = tib_dbl("a looooooooooooooooooooong name",
    .fill = 1)), width = 60)
Output
  tib_row(
    "path",
    a_long_name = tib_dbl(
      "a looooooooooooooooooooong name",
      .fill = 1,
    ),
  )
Code
  print(tib_row("path", a_long_name = tib_dbl("a looooooooooooooooooooong name",
    .fill = 1)), width = 69)
Output
  tib_row(
    "path",
    a_long_name = tib_dbl("a looooooooooooooooooooong name", .fill = 1),
  )

format for tib_vector works

Code
  tib_chr_vec("a")
Output
  tib_chr_vec("a")
Code
  tib_vector("a", .ptype = vctrs::new_duration())
Output
  tib_vector("a", .ptype = vctrs::new_duration())
Code
  tib_vector("a", .ptype = vctrs::new_duration(), .input_form = "object",
  .values_to = "vals", .names_to = "names")
Output
  tib_vector(
    "a",
    .ptype = vctrs::new_duration(),
    .input_form = "object",
    .values_to = "vals",
    .names_to = "names",
  )
Code
  tib_int_vec("a", .fill = 1:2)
Output
  tib_int_vec("a", .fill = 1:2)
Code
  tib_int_vec(.key = "x", .ptype_inner = character(), .fill = 1:2)
Output
  tib_int_vec(
    "x",
    .fill = 1:2,
    .ptype_inner = character(0),
  )
Code
  tib_lgl_vec("lgl")
Output
  tib_lgl_vec("lgl")
Code
  tib_int_vec("int")
Output
  tib_int_vec("int")
Code
  tib_dbl_vec("dbl")
Output
  tib_dbl_vec("dbl")
Code
  tib_chr_vec("chr")
Output
  tib_chr_vec("chr")
Code
  tib_date_vec("date")
Output
  tib_date_vec("date")

format for tib_chr_date works (#47)

Code
  tib_chr_date("a")
Output
  tib_chr_date("a")
Code
  tib_chr_date("a", .required = FALSE, .fill = "2022-01-01", .format = "%Y")
Output
  tib_chr_date(
    "a",
    .required = FALSE,
    .fill = "2022-01-01",
    .format = "%Y",
  )
Code
  tib_chr_date_vec("a")
Output
  tib_chr_date_vec("a")
Code
  tib_chr_date_vec("a", .required = FALSE, .fill = as.Date("2022-01-01"),
  .format = "%Y")
Output
  tib_chr_date_vec(
    "a",
    .required = FALSE,
    .fill = as.Date("2022-01-01"),
    .format = "%Y",
  )

format for tib_row works

Code
  tib_row("formats", text = tib_chr("text", .fill = NA_character_))
Output
  tib_row(
    "formats",
    tib_chr("text"),
  )
Code
  tib_row("formats", text = tib_chr("text"), .required = FALSE)
Output
  tib_row(
    "formats",
    .required = FALSE,
    tib_chr("text"),
  )
Code
  tib_row("basic_information", labels = tib_row("labels", name = tib_chr("name"),
  entity_type = tib_chr("entity_type"), catno = tib_chr("catno"), resource_url = tib_chr(
    "resource_url"), id = tib_int("id"), entity_type_name = tib_chr(
    "entity_type_name")), year = tib_int("year"), master_url = tib_chr(
    "master_url", .fill = NA), artists = tib_df("artists", join = tib_chr("join"),
  name = tib_chr("name"), anv = tib_chr("anv"), tracks = tib_chr("tracks"), role = tib_chr(
    "role"), resource_url = tib_chr("resource_url"), id = tib_int("id")), id = tib_int(
    "id"), thumb = tib_chr("thumb"), title = tib_chr("title"), formats = tib_df(
    "formats", descriptions = tib_chr_vec("descriptions", .fill = NULL), text = tib_chr(
      "text", .fill = NA), name = tib_chr("name"), qty = tib_chr("qty")),
  cover_image = tib_chr("cover_image"), resource_url = tib_chr("resource_url"),
  master_id = tib_int("master_id"))
Output
  tib_row(
    "basic_information",
    tib_row(
      "labels",
      tib_chr("name"),
      tib_chr("entity_type"),
      tib_chr("catno"),
      tib_chr("resource_url"),
      tib_int("id"),
      tib_chr("entity_type_name"),
    ),
    tib_int("year"),
    tib_chr("master_url"),
    tib_df(
      "artists",
      tib_chr("join"),
      tib_chr("name"),
      tib_chr("anv"),
      tib_chr("tracks"),
      tib_chr("role"),
      tib_chr("resource_url"),
      tib_int("id"),
    ),
    tib_int("id"),
    tib_chr("thumb"),
    tib_chr("title"),
    tib_df(
      "formats",
      tib_chr_vec("descriptions"),
      tib_chr("text"),
      tib_chr("name"),
      tib_chr("qty"),
    ),
    tib_chr("cover_image"),
    tib_chr("resource_url"),
    tib_int("master_id"),
  )

format for tib_variant works

Code
  tib_variant("a")
Output
  tib_variant("a")
Code
  tib_variant("a", .fill = tibble(a = 1:2))
Output
  tib_variant(
    "a",
    .fill = c("structure(list(a = 1:2), row.names = c(NA, -2L), class = c(\"tbl_df\", ", "\"tbl\", \"data.frame\"))"),
  )
Code
  tib_variant("a", .elt_transform = as.character)
Output
  tib_variant("a", .elt_transform = .Primitive("as.character"))

format for tib_df works

Code
  tib_df("formats", text = tib_chr("text", .fill = NA_character_))
Output
  tib_df(
    "formats",
    tib_chr("text"),
  )
Code
  tib_df("formats", text = tib_chr("text"), .required = FALSE)
Output
  tib_df(
    "formats",
    .required = FALSE,
    tib_chr("text"),
  )
Code
  tib_df("formats", .names_to = "nms", text = tib_chr("text"))
Output
  tib_df(
    "formats",
    .names_to = "nms",
    tib_chr("text"),
  )

format for tib_recursive works (#155)

Code
  tib_recursive("data", .children = "children", tib_int("id"), tib_chr("name"))
Output
  tib_recursive(
    "data",
    .children = "children",
    tib_int("id"),
    tib_chr("name"),
  )
Code
  tib_recursive("data", .children = "children", tib_int("id"), tib_chr("name"),
  .required = FALSE)
Output
  tib_recursive(
    "data",
    .children = "children",
    .required = FALSE,
    tib_int("id"),
    tib_chr("name"),
  )

special ptypes correctly formatted

Code
  format(tib_scalar("a", .ptype = character(), .ptype_inner = Sys.Date()))
Output
  [1] "tib_chr(\"a\", .ptype_inner = vctrs::new_date())"
Code
  format(tib_scalar("a", .ptype = character(), .ptype_inner = Sys.time()))
Output
  [1] "tib_chr(\"a\", .ptype_inner = vctrs::new_datetime(tzone = \"\"))"


Try the tibblify package in your browser

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

tibblify documentation built on May 9, 2026, 5:07 p.m.