I need to get a graph that has the average cumulative mortality for two populations of oysters at 4 different salinities.
Date = c("5/29/2017","5/31/2017","6/2/2017", "5/29/2017","5/31/2017","6/2/2017","5/29/2017","5/31/2017","6/2/2017","5/29/2017","5/31/2017","6/2/2017","5/29/2017","5/31/2017 ","6/2/2017","5/29/2017 ","5/31/2017","6/2/2017", "5/29/2017","5/31/2017","6/2/2017","5/29/2017", "5/31/2017","6/2/2017")
Mortality = c(0, 0.4, 0.5, 0.1, 0.3, 0.4, 0.2, 0.3, 0.5, 0.1, 0.2, 0.6, 0, 0.7, 0.8, 0.1, 0.6, 0.9, 0.1, 0.5, 0.9, 0.1, 0.6, 0.8)
Tank = c("1A", "1A", "1A", "1B", "1B", "1B", "5A", "5A", "5A", "5B", "5B", "5B", "1A", "1A", "1A", "1B", "1B", "1B", "5A", "5A", "5A", "5B", "5B", "5B")
Population = c("SL", "SL", "SL", "SL", "SL", "SL", "SL", "SL", "SL", "SL", "SL", "SL", "LC", "LC", "LC", "LC", "LC", "LC", "LC", "LC", "LC", "LC", "LC", "LC") = c (SL SL SL SL SL SL SL SL SL SL SL SL LC LC LC LC LC LC LC LC LC LC LC LC)
I need to average the two values (for example 1A and 1B) and then plot that value for the date. I would like only the dates where cumulative mortality was calculated to show on the x axis.
I have the following graph I made in Excel, but isn't quite what I need.
Here is my solution using
ggplot2
anddplyr
You could use other packages to summarise your data before plotting. Here I made two groups (1 = 1A and 1B, 2 = other tanks).
Just out of curiousity, why do you not use Kapplan-Meier plots for these data?