0

I am trying to calculate the percentages of a data set with summarise() and tidyverse.

For example:

Animal Count
Horse 2
Dog 6

How would I use summarise() so that I can say that the percentage of horses is .25%, and the percentages of dogs is 75%? Thanks!

I tried using count() and n() but it didn't work.

  • This should work: `data.frame(animal=c("Horse","Dog"), count=c(2, 6)) %>% mutate(count/sum(count))` – MrFlick Nov 17 '22 at 21:17

0 Answers0