# NOT RUN {
# Supply the type either with a string:
as.list(letters) %>% as_vector("character")
# Or with a vector mold:
as.list(letters) %>% as_vector(character(1))
# Vector molds are more flexible because they also specify the
# length of the concatenated vectors:
list(1:2, 3:4, 5:6) %>% as_vector(integer(2))
# Note that unlike vapply(), as_vector() never adds dimension
# attributes. So when you specify a vector mold of size > 1, you
# always get a vector and not a matrix
# }
Run the code above in your browser using DataLab