library(tidyr)
tbl <- tibble(x = c(1, 1, 1), ya = 1:3, yb = 4:6)
res <- nest(tbl, y = starts_with("y"), .names_sep = "")
res$y[[1]]
#> # A tibble: 3 × 2
#> a b
#> <int> <int>
#> 1 1 4
#> 2 2 5
#> 3 3 6
df <- as.data.frame(tbl)
res <- nest(df, y = starts_with("y"), .names_sep = "")
res$y[[1]]
#> # A tibble: 3 × 2
#> ya yb
#> <int> <int>
#> 1 1 4
#> 2 2 5
#> 3 3 6
Created on 2021-10-27 by the reprex package (v2.0.1)