Percentage of something

I am working on a real estate dataset (property) and have a column that includes owner-occupied houses(OWN), so the column has Yes and No if its owned by the owner or not and I wanted to find the percent of owners that own the house, any suggestions on how would I go about doing it?

Owner<-property %>% as.character(property$OWN) %>% mutate(houses=OWN=='Y'/sum(OWN) *100)

An example using dplyr and the iris dataset:

iris %>% 
  count(Species) %>% 
  mutate(pct = n/sum(n)*100)

     Species  n      pct
1     setosa 50 33.33333
2 versicolor 50 33.33333
3  virginica 50 33.33333

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.