I have data like this:
DF <- data.frame(Majors = c('Sam', 'Bob', 'Henry', 'John', 'Ted', 'Carl',
'Robert', 'Matt', 'Jared', 'Jack', 'Greg',
'Arthur', 'Glenn'),
MEASURES = c('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
'I', 'J', 'K', 'L', 'M'),
LCOs = c(1.1, 2.1, 3.3, 4.1, 1.2, 1.1,
2.4, 3.3, 2.3, 1.1, 2.1, 1.4, 7),
Years=c('2017-2018', '2017-2018', '2017-2018',
'2018-2019', '2018-2019', '2018-2019',
'2018-2019', '2019-2020', '2020-2021',
'2020-2021', '2020-2021', '2020-2021',
'2021-2022'))
My goal is to plot (or table?) this so that Majors
is x-axis/bottom, Measures
is y-axis/side, LCOs
is plotted accordingly, and Years
is represented by coloring the plotted LCOs
values. Based on my attempts so far, I'm thinking ggplot2
options may not be best. But kable
doesn't seem to want to "plot" (for lack of better term) them.
I'd very grateful for any help!
EDIT TO INCLUDE PITIFUL SKETCH OF DESIRED OUTCOME
library(tidyverse)
ggplot(DF |> mutate(Majors = factor(Majors) |> fct_inorder(),
MEASURES = factor(MEASURES) |> fct_rev()),
aes(Majors, MEASURES, label = LCOs, color = Years)) +
geom_text() +
theme_minimal() +
theme(panel.grid = element_blank())