I have two long format datasets: df1 with time and the growth of different species. df2 with their corresponding standard deviation for each point.
(I made simplified versions of the data below, real data consists of many additional species) df1:
time | species | OD |
---|---|---|
1 | sp_a | 0.2 |
2 | sp_a | 0.3 |
3 | sp_a | 0.4 |
1 | sp_b | 0.1 |
2 | sp_b | 0.15 |
df2:
time | species | sd |
---|---|---|
1 | sp_a | 0.05 |
2 | sp_a | 0.02 |
3 | sp_a | 0.08 |
1 | sp_b | 0.04 |
2 | sp_b | 0.02 |
How can I make a time series plot with x=time and y=OD, and error bars using ggplot2 without manually having to add the corresponding error bars from the standard deviation of every single species?
Thank you very much in advance :)