search for: vec_c2

Displaying 2 results from an estimated 2 matches for "vec_c2".

Did you mean: vec_c
2018 Aug 06
2
vctrs: a type system for the tidyverse
...by `vec_cast()` (which also uses double dispatch): str(lapply(vecs, vec_cast, to = type)) #> List of 3 #> $ : num 1 #> $ : num [1:10] 1 2 3 4 5 6 7 8 9 10 #> $ : num 1.5 All up, this means that we can implement the essence of `vec_c()` in only a few lines: vec_c2 <- function(...) { args <- list(...) type <- Reduce(vec_type, args) cast <- lapply(type, vec_cast, to = type) unlist(cast, recurse = FALSE) } vec_c(factor("a"), factor("b")) #> [1] a b #> Levels: a b vec_c(Sys.Date...
2018 Aug 06
0
vctrs: a type system for the tidyverse
...> > str(lapply(vecs, vec_cast, to = type)) > #> List of 3 > #> $ : num 1 > #> $ : num [1:10] 1 2 3 4 5 6 7 8 9 10 > #> $ : num 1.5 > > All up, this means that we can implement the essence of `vec_c()` in > only a few lines: > > vec_c2 <- function(...) { > args <- list(...) > type <- Reduce(vec_type, args) > > cast <- lapply(type, vec_cast, to = type) > unlist(cast, recurse = FALSE) > } > > vec_c(factor("a"), factor("b")) > #> [1] a...