I need help with this. Not sure i understand why my data is not in a recognized alluvial form. I used exactly the majors example and set my data the same way.
alluviatable <- cleandata.pivot %>%
select(MRN, command_score_day, command_score)
alluviatable$command_score <- as.factor(alluviatable$command_score)
alluviatable$command_score_day <- as.factor(alluviatable$command_score_day)
alluviatable$MRN <- as.integer(alluviatable$MRN)
ggplot(alluviatable,
aes(x = command_score_day, stratum = command_score, alluvium = "MRN", fill = command_score)) +
scale_fill_brewer(type = "qual", palette = "Set2") +
geom_flow(stat = "alluvium", lode.guidance = "frontback",
color = "darkgray") +
geom_stratum() +
theme(legend.position = "bottom") +
ggtitle("Command Score across days")