# NOT RUN {
T1 <- xtabs(~size + status, data = Tonsils)
T1
prop.table(T1, 1)
prop.table(T1, 1)[2, 1]
barplot(t(T1), legend = TRUE, beside = TRUE, col = c("red", "green"))
# }
# NOT RUN {
library(dplyr)
library(ggplot2)
NDF <- dplyr::count(Tonsils, size, status)
ggplot2::ggplot(data = NDF, aes(x = size, y = n, fill = status)) +
geom_bar(stat = "identity", position = "dodge") +
scale_fill_manual(values = c("red", "green")) +
theme_bw()
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab