I'm trying to visualize a cohort analysis, and wanted to use RenderDataTable
in shiny to get this sort of a visualization where I would be able to highlight all the cells based on a separate column having values 1/0, with 1 being shaded and 0 not being shaded.
I Tried a couple of things, including trying to use geom_tile
in ggplot2
, but it was of no avail. I also tried looking at rpivotTable
, but I wasn't able to figure out how to shade certain cells.
Example Data:
df <- "
cohort wk value flag
1 1 24 0
1 2 12 0
1 3 10 0
1 4 5 0
1 5 2 0
2 1 75 0
2 2 43 1
2 3 11 0
2 4 14 0
3 1 97 0
3 2 35 0
3 3 12 1
4 1 9 0
4 2 4 0
5 1 5 0"
df <- read.table(text = df, header = TRUE)