dplyr::select of nested data frame

Viewed 3231

I have the following example data frame:

library(tibble)
library(tidyverse)
df <- tibble(A = 1, B = 1)
df2 <- tibble(C = 2:4, D = 4:6)
df <- df %>%
        nest(B) %>%
        mutate(data = map(data, ~df2))

It's a nested 3x2 data frame (df2) in a 1x2 data frame (df). Is there a way to combine purrr::map and dplyr::select to select only column C in the nested data frame? I'm hoping to avoid unnest. The outcome should be:

      A             data
  <dbl>           <list>
1     1 <tibble [3 x 1]>
1 Answers
Related