Skip to content

Commit

Permalink
chore: Auto-update from GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
moodymudskipper authored and aviator-bot committed Sep 19, 2024
1 parent 73a6407 commit 72742c6
Showing 1 changed file with 92 additions and 0 deletions.
92 changes: 92 additions & 0 deletions tests/testthat/_snaps/s3-tbl_df.new.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# tbl_df

Code
construct(dplyr::band_members)
Output
tibble::tibble(name = c("Mick", "John", "Paul"), band = c("Stones", "Beatles", "Beatles"))
Code
construct(dplyr::band_members, opts_tbl_df("next"))
Output
data.frame(name = c("Mick", "John", "Paul"), band = c("Stones", "Beatles", "Beatles")) |>
structure(class = c("tbl_df", "tbl", "data.frame"))
Code
construct(dplyr::band_members, opts_tbl_df("next"), opts_data.frame("next"))
Output
list(name = c("Mick", "John", "Paul"), band = c("Stones", "Beatles", "Beatles")) |>
structure(class = c("tbl_df", "tbl", "data.frame"), row.names = c(NA, -3L))
Code
construct(dplyr::band_members, opts_tbl_df(constructor = "tribble"))
Output
tibble::tribble(
~name, ~band,
"Mick", "Stones",
"John", "Beatles",
"Paul", "Beatles",
)
Code
construct(dplyr::band_members, opts_tbl_df(constructor = "tribble", justify = "right"))
Output
tibble::tribble(
~name, ~band,
"Mick", "Stones",
"John", "Beatles",
"Paul", "Beatles",
)
Code
construct(tibble::tibble(a = as.Date("2001-01-01")), opts_tbl_df("tribble"))
Output
tibble::tribble(
~a,
as.Date("2001-01-01"),
)
Code
construct(dplyr::group_by(dplyr::band_members, band))
Output
tibble::tibble(name = c("Mick", "John", "Paul"), band = c("Stones", "Beatles", "Beatles")) |>
dplyr::group_by(band)

# tbl_df with `tribble = TRUE` falls back on tibble() if unsupported cols are found

Code
construct(tibble::tibble(a = 1:2, b = list(3, 4)), opts_tbl_df(constructor = "tribble"))
Output
tibble::tibble(a = 1:2, b = list(3, 4))
Code
construct(tibble::tibble(a = 1:2, b = tibble::tibble(x = 3:4)), opts_tbl_df(
constructor = "tribble"))
Output
tibble::tibble(
a = 1:2,
b = tibble::tribble(
~x,
3L,
4L,
),
)

# recycle in tibbles

Code
construct(tibble::tibble(a = 1:2, b = c(1, 1)))
Output
tibble::tibble(a = 1:2, b = 1)
Code
construct(tibble::tibble(a = c(1, 1), b = c(1, 1)))
Output
tibble::tibble(a = 1, b = 1, .rows = 2L)
Code
construct(tibble::tibble(a = 1:2, b = factor(c("a", "a"))))
Output
tibble::tibble(a = 1:2, b = factor("a"))
Code
construct(tibble::tibble(a = 1:2, b = as.Date(c("2000-01-01", "2000-01-01"))))
Output
tibble::tibble(a = 1:2, b = as.Date("2000-01-01"))

# duplicate names in tibbles

Code
construct(tibble::tibble(a = 1, a = 2, .name_repair = "minimal"))
Output
tibble::tibble(a = 1, a = 2, .name_repair = "minimal")

0 comments on commit 72742c6

Please sign in to comment.