I'm a newbie to R. I have two stations (1 and 2). Each station has two variables (a and b). I want to plot the change in these variables over time using ggplot.
I tried this code to plot the data (You can get the data from this link https://goo.gl/t6fvAJ)
data1 <- read.csv("Stations1.csv", sep=",", header=T)
names(data1)
data1$Date<-as.Date(data1$X, format="%d/%m/%Y")
library(ggplot2)
ggplot(data1, aes(x=Date, y=Y, group=Var)) +
geom_line() + theme_bw() + facet_wrap(~station, ncol=4, scales="free_y") + xlab("Date")+ylab("")
I couldn't see the changes in variable "b" because it has different scale than variable "a"
I need to add a secondary Y axis to ggplot2 so I can show the changes in variable "b" over time.
Is there any way to do this in ggplot2?