| tspec_df | R Documentation |
Use tspec_df() to specify how to convert a list of objects to a tibble. Use
tspec_row() to specify how to convert an object to a one-row tibble. Use
tspec_object() to specify how to convert an object to a list.
tspec_df(
...,
.input_form = c("rowmajor", "colmajor"),
.names_to = NULL,
.vector_allows_empty_list = FALSE,
vector_allows_empty_list = deprecated()
)
tspec_object(
...,
.input_form = c("rowmajor", "colmajor"),
.vector_allows_empty_list = FALSE,
vector_allows_empty_list = deprecated()
)
tspec_row(
...,
.input_form = c("rowmajor", "colmajor"),
.vector_allows_empty_list = FALSE,
vector_allows_empty_list = deprecated()
)
tspec_recursive(
...,
.children,
.children_to = .children,
.input_form = c("rowmajor", "colmajor"),
.vector_allows_empty_list = FALSE,
vector_allows_empty_list = deprecated()
)
... |
( |
.input_form |
(
|
.names_to |
( |
.vector_allows_empty_list, vector_allows_empty_list |
( |
.children |
( |
.children_to |
( |
In column-major format, all fields are required, regardless of the
.required argument.
A tibblify specification.
tspec_df(
id = tib_int("id"),
name = tib_chr("name"),
aliases = tib_chr_vec("aliases")
)
# Equivalent to
tspec_df(
tib_int("id"),
tib_chr("name"),
tib_chr_vec("aliases")
)
# To create multiple columns of the same type use the bang-bang-bang (`!!!`)
# operator together with `purrr::map()`
tspec_df(
!!!purrr::map(rlang::set_names(c("id", "age")), tib_int),
!!!purrr::map(rlang::set_names(c("name", "title")), tib_chr)
)
# The `tspec_*()` functions can also be nested
spec1 <- tspec_object(
int = tib_int("int"),
chr = tib_chr("chr")
)
spec2 <- tspec_object(
int2 = tib_int("int2"),
chr2 = tib_chr("chr2")
)
tspec_df(spec1, spec2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.