I am trying to construct a bar plot with percentage on the y axis. I have some data in table format and want to plot it into bar plot
library(survival)
kidney$mortality <- ifelse(kidney$status==1, "Dead", "Alive")
table1(~ disease
| mortality * sex, data=kidney )
I am trying to assess the probability of people who died in each disease category and the numbered category like this
- For all the people in category 1 and disease other (6 total) divided by the number of dead 1s in the other disease category (6 total) with a bar at 100 percent because 6/6.
There will be a total of 8 bars in this case.
How would I work this into a solid ggplot barplot with the percent on the y axis?
