I want a create a pie chart below. But I can add the percentage number to the slices. Below is my code. Thanks for helping.
slices <- c(51,49)
cs <- c("male", "female")
pie(slices, labels = cs, col=c("blue", "red"), main="Female male ration at Harvard")
CodePudding user response:
You could do
slices <- c(51,49)
cs <- c("male", "female")
pie(slices, labels = paste0(cs, ' ', slices, '%'),
col=c("blue", "red"), main="Female male ratio at Harvard")