how do i manipulate with purrr verbs v0
to return a 2x4 tibble where columns 2:4 are the nested outputs of the v()
, ie names(v1)
is c('x','a','b','c')
instead of a 2x2 c('x','out')
(which is what i get now)
v0 <- as_tibble(data.frame(x=c(15,30)))
v <- function(x) list(a=mtcars[1:x,],b=iris[1:x,],c=volcano[1:x,])
v1 <- v0%>%mutate(out=purrr::map(x,v))
obviously the elements arent assumed to be just matrices and data.frames but any class that is consistent across rows