Suppose I have a tbl_df called pokemons like this:
pokemons
X. Name Type.1 Type.2 Total HP Attack Defense Sp..Atk Sp..Def Speed Gen
We can do
summaryStats_byType1 <- pokemons %>% group_by(Type.1) %>% summarise(count = n(), averageTotal = mean(Total, na.rm = T), medianGeneration = median(Generation, na.rm = T), CountLegendary = sum(as.character(Legendary)=="True"))