-
Notifications
You must be signed in to change notification settings - Fork 1
/
IDEAS2020workshop.rmd
64 lines (41 loc) · 1.2 KB
/
IDEAS2020workshop.rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
---
title: "IDEAS Comp Bio workshop 2020"
author: "Lambodhar Damodaran"
date: "5/19/2020"
output: pdf_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## Libraries needed
```{r}
library(lubridate)
library(ggplot2)
library(plotly)
```
## R Markdown
Reading in data file for mers and manipulating to determine days since onset of epidemic, reformmating date information.
```{r}
mers <- read.csv('cases.csv')
mers$hospitalized[890] <- c('2015-02-20')
mers <- mers[-471,]
mers$onset2 <- ymd(mers$onset)
mers$hospitalized2 <- ymd(mers$hospitalized)
class(mers$onset2)
day0 <- min(na.omit(mers$onset2))
mers$epi.day <- as.numeric(mers$onset2 - day0)
```
##Plots data
Plotting MERS epidemnic day vs case count using ggplot.
```{r}
ggplot(data=mers) +
geom_bar(mapping = aes(x=epi.day)) +
labs(x='Epidemic day', y='Case count', title = 'Global MERS case count by dat of onset', caption = 'Data from Rambaut - MERS')
```
## Interactive plotly plot
```{r}
epi.curve <- ggplot(data=mers) +
geom_bar(mapping=aes(x=epi.day)) +
labs(x='Epidemic day', y='Case count', title='Global MERS case count by onset date', caption = 'Data from Rambaut - MERS')
ggplotly(epi.curve)
```