on-internet
← Community

How to name the list of the group_split output in dplyr

Stack Overflow ·

I have the following process which uses group_split of dplyr: library(tidyverse) set.seed(1) iris %>% sample_n(size = 5) %>% group_by(Species) %>% group_split() The result is: [[1]] # A tibble: 2 x 5 Sepal.Length Sepal.Width Petal.Length Petal.Width Species <dbl> <dbl> <dbl> <dbl> <fct> 1 5 3.5 1.6 0.6 setosa 2 5.1 3.8 1.5 0.3 setosa [[2]] # A tibble: 2 x 5 Sepal.Length Sepal.Width Petal.Length Petal.Width Species <dbl> <dbl> <dbl> <dbl> <fct> 1 5.9 3 4.2 1.5 versicolor 2 6.2 2.2 4.5 1.5 versicolor [[3]] # A tibble: 1 x 5 Sepal.Length Sepal.Width Petal.Length Petal.Width Species <dbl> <dbl> <d

Comments

Sign in or sign up to comment and upvote.

No comments yet.