Combine specifications created by tspec_df(), tspec_row(), or
tspec_object(). The resulting specification includes all fields from the
input specifications.
Details
If a field is specified in multiple input specifications, the field specifications will be combined to produce a single field specification, using the most specific specification for each argument. See the examples for details.
Examples
# union of fields
tspec_combine(
tspec_df(tib_int("a")),
tspec_df(tib_chr("b"))
)
#> tspec_df(
#> tib_int("a", .required = FALSE),
#> tib_chr("b", .required = FALSE),
#> )
# unspecified + x -> x
tspec_combine(
tspec_df(tib_unspecified("a")),
tspec_df(tib_int("a"))
)
#> tspec_df(
#> tib_int("a"),
#> )
# scalar + vector -> vector
tspec_combine(
tspec_df(tib_chr("a")),
tspec_df(tib_chr_vec("a"))
)
#> tspec_df(
#> tib_chr_vec("a"),
#> )
# scalar/vector + variant -> variant
tspec_combine(
tspec_df(tib_chr("a")),
tspec_df(tib_chr_vec("a")),
tspec_df(tib_variant("a"))
)
#> tspec_df(
#> tib_variant("a"),
#> )