Experiment
tribble(~disease, ~test_positive, ~symptoms, ~weight,
1, 1, 1, .1588, # true positive, symptoms
1, 0, 1, .025, # false negative, symptoms
0, 1, 1, .02, # false positive, symptoms
0, 0, 1, .20, # true negative, symptoms
1, 1, 0, .025, # true positive, no symptoms
1, 0, 0, .0512, # false negative, no symptoms
0, 1, 0, .15, # false positive, no symptoms
0, 0, 0, 2.80 # true negative, no symptoms
) ->
testing
library(ind2cat)
testing %>%
mutate(disease = ind_recode(disease)) %>%
mutate(test_positive = ind_recode(test_positive)) %>%
mutate(symptoms = ind_recode(symptoms)) ->
testing_factors
ggplot(testing_factors) +
aes(weight = weight) +
ggwedge:::geom_pie(color = "grey",
linewidth = 1.5) +
ggwedge:::geom_pie_label(r_prop = 1.15) +
coord_polar() +
aes(alpha = disease) +
scale_alpha_discrete(range = c(.6,1)) +
theme_void()
## Warning: Using alpha for a discrete variable is not advised.
last_plot() +
aes(alpha = NULL) +
aes(fill = test_positive) +
scale_fill_manual(values = c("cadetblue", "darkred"))
last_plot() +
aes(fill = NULL) +
aes(linetype = symptoms)
last_plot() +
aes(linetype = NULL) +
aes(alpha = disease) +
aes(fill = test_positive) +
facet_grid(.~disease)
last_plot() +
facet_wrap(~test_positive)
last_plot() +
aes(linetype = symptoms) +
facet_grid(symptoms~test_positive)
last_plot() %+%
(testing_factors %>% filter(symptoms == "symptoms"))
last_plot() %+%
facet_null() +
aes(fill = NULL)