options(scipen=999)
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(ggplot2)
library(patchwork)
library(hrbrthemes)
## NOTE: Either Arial Narrow or Roboto Condensed fonts are required to use these themes.
## Please use hrbrthemes::import_roboto_condensed() to install Roboto Condensed and
## if Arial Narrow is not on your system, please see https://bit.ly/arialnarrow
library(readr)
Frost <- read_csv("Frost.csv")
## Warning: Missing column names filled in: 'X1' [1]
## Parsed with column specification:
## cols(
## X1 = col_double(),
## gen = col_double(),
## new = col_double(),
## sus = col_double()
## )
View(Frost)
head(Frost)
## # A tibble: 6 x 4
## X1 gen new sus
## <dbl> <dbl> <dbl> <dbl>
## 1 1 0 0 100
## 2 2 1 1 99
## 3 3 2 2 97
## 4 4 3 4 93
## 5 5 4 6 87
## 6 6 5 11 76
Frost %>%
ggplot(aes(x=gen*1.5)) +
geom_line(aes(y=sus/10), size=2, color="red") +
geom_line(aes(y=new/1), size=2, color="blue") +
scale_x_continuous(name = "Generation of Epidemic") +
scale_y_continuous(
#Left Axis (Name)
name = "No. of New Cases in Generation",
#Right Axis (Name & Scale)
sec.axis = sec_axis(trans=~.*10, name= "No. of Remaining Susceptibles")) +
theme_ipsum() +
ggtitle("Figure 1: Epidemic Curve")
