zero_one | R Documentation |
A convenience function for handling categorical response variables. Ordinarily, ggplot2 maps categorical levels to numerical values 1, 2, .... Such numerical mapping is inappropriate for logistic modeling, where we want the levels to be on a probability scale.
zero_one(x, one)
label_zero_one(P)
x |
a categorical variable |
one |
character string specifying the level that gets mapped to 1. |
P |
A ggplot2 object made by |
A numerical vector of 0s and 1s.
Birdkeepers |>
point_plot(zero_one(LC, one="LungCancer") ~ AG + BK, annot = "model")
Birdkeepers |>
mutate(Condition = zero_one(LC, one = "LungCancer")) |>
point_plot(Condition ~ AG + BK, annot = "model") |>
label_zero_one() |>
add_plot_labels(x="age", color = "Birdkeeper?")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.