I have a dataset with the following properties:
- multiple locations
- open for different lengths of time
- with different carers present at different time points
Here's a bit of sample code:
dt <- tibble(
"location" = c("A", "B", "C", "D", "A", "B", "C", "A", "B", "C", "A", "B", "A", "A", "A"),
"months.since.start" = c(0,0,0,0,1,1,1,2,2,2,3,3,4,5,6),
"carer" = c("HCA", "nurse", "nurse", "dr", "HCA", "dr", "nurse", "HCA", "dr", "nurse", "dr", "HCA", "dr", "nurse", "HCA")
)
What I would like to do is ideally 2 different things:
- overlay the histogram with the counts (plot A below) in line form on top of the histogram with the proportions (plot B below)
- overlay the number with the count of active locations (the
geom_text
in plot A) above the proportions (in plot B)
I'm aware that they function on different axes which is addressed in this post, but I don't need the axis of plot A to be shown, its only to show the change in active locations over time.
I suspect the first part could be done by dividing the total count by 4 (i.e the total number of active locations) and then layering the histogram on top of the proportional count, but I'm unsure how to do that.