> library(dplyr)
> test %>%
+ group_by(name) %>%
+ summarise_all(mean)
# A tibble: 3 x 3
name counts.1 counts.2
<chr> <dbl> <dbl>
1 Peak160 261 429
2 Peak328 6.5 62
3 Peak344 4.5 51
• 0 views
•
link
What have you tried? Look at dplyr's
group_by()andsummarise()functions. There are ways to do it in base R too, but this might be easier.