Using the group_by function of dplyr to control the collection of a data.frame object

This is my first question that I have ever raised in this community, I hope that I can solve my doubts by transferring great experienced people here. I have three groups, each of which contains 3 different data.frame objects with different lengths and sizes. I want some manipulations to group them by specific data.frame objects. I think that group_by from the dply package can accomplish this task, but I'm not sure about it, and even I did not know about using dplyr packages, so please give me your input. Thanks to everyone.

Here is a simple reproducible example to make my question clear:

simulated data

group1 <- list(a1 <- iris[1:10,],
               b1 <- airquality[1:20,],
               c1 <- cars[1:20,])

group2 <- list(a2 <- iris[15:35,],
               b2 <- airquality[10:25,],
               c2 <- cars[15:30,])
group3 <- list(a3 <- iris[40:60,],
               b3 <- airquality[30:50,],
               c3 <- cars[25:45,])

, group1, group2, group3 R-, , data.frame. , :

:

group_a <- list(a1, a2, a3)
group_b <- list(b1, b2, b3)
group_c <- list(c1, c2, c3)

, , , , , , R, , , . - , , ? , .

+4
1

transpose purrr list

library(purrr)
lst <- transpose(list(group1, group2, group3))
group1New <- lst[[1]]
group2New <- lst[[2]]
group3New <- lst[[3]]
+5

Source: https://habr.com/ru/post/1648150/


All Articles