It looks like you can resuse the code from GGplot - Test Information Functions for multiple groups by creating the analogue of groups
immediately after you first create the table l.format
-- you can leave the call to factor()
until later:
items <-
l.format %>%
group_by(item) %>%
arrange(abs(P.1-0.5)) %>%
slice(1) %>%
ungroup() %>%
arrange(Theta) %>%
pull(item)
Then just replace group
and groups
by item
and items
in the ggplot()
section of the code from GGplot - Test Information Functions for multiple groups. Does this work for you?