I have two questions, the first a (hopefully) straightforward mechanical one and the second more theoretical (though still with a technical element).
I am trying to do something nearly identical to this question, but I have a variable that is ordered/continuous (0 - 4), instead of a 1/0 dichotomous variable, which means that filtering == 1 will not work. To summarize here, I simply want to display the percent of each level within each race category.
I am also hoping to figure out a way to display those descriptive results for all 3 questions in just one figure. I first thought about trying to do some type of
facet_wrap()with each variable (question1, question2, question3) being its own panel. Would that requirepivot_longer()to make my data long instead of wide? Another thought was to have just one figure/panel, but each x axis tick is a race category instead of a question, and then it'd have 3 bars for each of the 3 questions. I'm not sure how I'd get that to work, though.
Thanks in advance and sorry for this wordy question. Here is some example data:
set.seed(123)
d <- data.frame(
race = sample(c("White", "Hispanic", "Black", "Other"), 100, replace = TRUE),
question1 = sample(0:4, 100, replace = TRUE),
question2 = sample(0:4, 100, replace = TRUE),
question3 = sample(0:4, 100, replace = TRUE)
)

