library(purrr)
library(tibble)
library(tidyr)
library(dplyr)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
myfunc <- function(x){
as.data.frame(t(paste(x,c('a','b','c'))))
}
tibble(var = c(1,2,3)) %>%
mutate(multi_output = map(var, ~myfunc(.x))) %>%
unnest(multi_output)
#> # A tibble: 3 x 4
#> var V1 V2 V3
#> <dbl> <fct> <fct> <fct>
#> 1 1 1 a 1 b 1 c
#> 2 2 2 a 2 b 2 c
#> 3 3 3 a 3 b 3 c