I like @RomanLustrik answer, so here's a 100% dplyr
approach to his answer.
do(mylist, function(df)
df %.%
group_by(b) %.%
summarise(count = n()))
## [[1]]
## Source: local data frame [2 x 2]
## b count
## 1 b 5
## 2 a 5
## [[2]]
## Source: local data frame [2 x 2]
## b count
## 1 b 5
## 2 a 5
In this answer I just tried to replicate Roman's approach but you can reuse your function (fn) :
fn <- function(df) {
summarise(df,
count = n())
}
group_by(df1, b) %.% fn()
## Source: local data frame [2 x 2]
## b count
## 1 b 5
## 2 a 5
group_by(df2, b) %.% fn()
## Source: local data frame [2 x 2]
## b count
## 1 b 5
## 2 a 5
And you can even wrap it like this
do(list(df1, df2), function(df) group_by(df, b) %.% fn())