Combine many vectors into one vector
Combine all arguments into a new vector of common type.
vec_c( ..., .ptype = NULL, .name_spec = NULL, .name_repair = c("minimal", "unique", "check_unique", "universal") )
... |
Vectors to coerce. |
.ptype |
If Alternatively, you can supply |
.name_spec |
A name specification for combining
inner and outer names. This is relevant for inputs passed with a
name, when these inputs are themselves named, like
See the name specification topic. |
.name_repair |
How to repair names, see |
A vector with class given by .ptype
, and length equal to the
sum of the vec_size()
of the contents of ...
.
The vector will have names if the individual components have names
(inner names) or if the arguments are named (outer names). If both
inner and outer names are present, an error is thrown unless a
.name_spec
is provided.
vec_size(vec_c(x, y)) == vec_size(x) + vec_size(y)
vec_ptype(vec_c(x, y)) == vec_ptype_common(x, y)
.
vec_cast_common()
with fallback
If inputs inherit from a common class hierarchy, vec_c()
falls
back to base::c()
if there exists a c()
method implemented for
this class hierarchy.
vec_cbind()
/vec_rbind()
for combining data frames by rows
or columns.
vec_c(FALSE, 1L, 1.5) # Date/times -------------------------- c(Sys.Date(), Sys.time()) c(Sys.time(), Sys.Date()) vec_c(Sys.Date(), Sys.time()) vec_c(Sys.time(), Sys.Date()) # Factors ----------------------------- c(factor("a"), factor("b")) vec_c(factor("a"), factor("b")) # By default, named inputs must be length 1: vec_c(name = 1) try(vec_c(name = 1:3)) # Pass a name specification to work around this: vec_c(name = 1:3, .name_spec = "{outer}_{inner}") # See `?name_spec` for more examples of name specifications.
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.