I have a list with n dataframes. They have a common variable called group
. I want to parse dataframes only with the groups a
and c
of group
.
My goal: Return these dataframes within the list with only these selected rows, based on group
.
Following reproducible example ( dput
) for response aid:
mylist=list(structure(list(number = c(26.1218564352021, 40.3910428239033,
29.2942556878552, 45.1165094505996, 26.7251219204627, 45.9554967121221,
47.5653750263155, 43.1406186055392, 47.4260813184083, 23.5751851135865
), group = structure(c(1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 3L
), .Label = c("a", "b", "c"), class = "factor")), class = "data.frame",
row.names = c(NA,
-10L)), structure(list(number = c(47.6476960512809, 22.61412369553,
48.3788266661577, 48.4475369821303, 41.6704738186672, 23.7482307478786,
28.8278631540015, 30.1230939105153, 27.1230523264967, 49.5825876342133,
40.2128369128332, 40.5727856047451, 48.3333457401022, 22.921603335999,
25.0721591082402), group = structure(c(1L, 1L, 1L, 2L, 2L, 2L,
3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 5L), .Label = c("a", "b", "c",
"d", "e"), class = "factor")), class = "data.frame", row.names = c(NA,
-15L)))