So what would be the correct way of adding those nested tibbles into my tibble? I know I can work with bind_cols to glue on a new tibble, but it would be nice if I could add my new values depending on other variables in the row - which is something that mutate can usually do nicely; so something like this:
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
library(tibble)
test = tribble(~a, ~b,
1, 2,
3, 4
)
library(purrr)
test2 <- test %>% mutate(c = map(999 , as_tibble))
test2
#> # A tibble: 2 x 3
#> a b c
#> <dbl> <dbl> <list>
#> 1 1 2 <tibble [1 x 1]>
#> 2 3 4 <tibble [1 x 1]>