purrr::map_dfr = lapply + dplyr::bind_rows
そういうことなんだよな〜シミュレーション系でよく使うのでメモ。
> dplyr::bind_rows(lapply(1:3, function(x){head(iris, 1)})) Sepal.Length Sepal.Width Petal.Length Petal.Width Species 1 5.1 3.5 1.4 0.2 setosa 2 5.1 3.5 1.4 0.2 setosa 3 5.1 3.5 1.4 0.2 setosa > purrr::map_dfr(1:3, ~ head(iris, 1)) Sepal.Length Sepal.Width Petal.Length Petal.Width Species 1 5.1 3.5 1.4 0.2 setosa 2 5.1 3.5 1.4 0.2 setosa 3 5.1 3.5 1.4 0.2 setosa