data %>%
group_by(nationality)%>%
summarise(n=n()) %>%
mutate(freq = paste0(round(100*n/sum(n),0), "%"))
I am runnig the code able and some of the results are 0%, I believe this is supposed to be a decimal. What can I add to this code to output decimals?
modify the number pasted to round()
is enough, e.g.:
data %>%
group_by(nationality)%>%
summarise(n=n()) %>%
mutate(freq = paste0(round(100*n/sum(n),4), "%"))
Thank you, that was helpful
system
Closed
4
This topic was automatically closed 7 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.