So based on your code I was able to come up with a similar approach, though assigning a rank to each:
y= tibble::tribble(
~barrierf_housing, ~barrierf_job, ~barrierf_family, ~barrierf_services, ~barrierf_education, ~barrierf_identification,
99L, 62L, 2L, 5L, 0L, 0L,
51L, 10L, NA, 100L, NA, NA,
27L, 100L, 56L, 55L, NA, 0L,
50L, 100L, 50L, 50L, 53L, 23L,
0L, 0L, 50L, 0L, 0L, 0L,
100L, 82L, 100L, 80L, 60L, 34L,
0L, 6L, 0L, 63L, 52L, 0L,
0L, 0L, 15L, 0L, 26L, 0L,
100L, 41L, 0L, 100L, NA, 100L
)
y=y %>% mutate(id=c(1:112))
y=y %>%
pivot_longer(
cols= starts_with("barrier"),
names_to = "variable",
values_to = "participant_score") %>%
arrange(id,participant_score) %>%
group_by(id) %>%
mutate(rank=rank(participant_score, ties.method = "min", na.last = TRUE))
y
This gives a pretty close output to what I'm looking for; by adding a few more lines like this...
y %>%
filter(rank==1) %>%
janitor::tabyl(variable) %>% janitor::adorn_pct_formatting()
...I can see how many people ranked each variable as most important, etc.
However, the ranks are backwards. I'd like the highest score to be ranked as 1 rather than 6
EDIT: I was able to flip the scores around by adding:
y$test=car::recode(y$rank,"1 = 6 ; 2 = 5 ; 3 = 4 ; 4 = 3 ; 5 = 2 ; 6 = 1")
Thanks for the advice!