tribble(
~colA, ~colB,
"a", 1,
"b", 2,
"c", 3
)
# tribble will create a list column if the value in any cell is
# not a scalar
tribble(
~x, ~y,
"a", 1:3,
"b", 4:6
)
# Use dplyr::mutate(dplyr::across(...)) to assign an explicit type
tribble(
~a, ~b, ~c,
1, "2000-01-01", "1.5"
) %>%
dplyr::mutate(
dplyr::across(a, as.integer),
dplyr::across(b, as.Date)
)
Run the code above in your browser using DataLab