I am trying to plot a line chart with 2 lines but with different scales: the left y axis as a continuous numeric and the right y axis as a percentage. Bellow is a sample:
data.frame(date=Sys.Date()-0:9,n=rnorm(10,200,10),p=210) %>%
mutate_if(is.numeric,round,0) %>%
mutate(perc=n/p) %>%
ggplot(.,aes(x=date)) +
geom_line(aes(y=n)) +
geom_line(aes(y=perc))
How can I accomplish that ?
Thanks