I want to make a line plot of date versus Ydet and Yobs in ggplot, I have tried, but couldn't achieved it. Can anyone help, please?
> library(ggplot2) > #cbind Ydet and Yobs > Ydet.obs <- cbind(Ydet, Yobs) > #create ts object starting from 2001 > ts <- seq(as.POSIXct("2001-01-01"), length.out=nrow(Ydet.obs), by = "year") > Ydet.obs <- xts(Ydet.obs[], ts) > #extract date column > Ydet.obs <- data.frame('Date' = index(Ydet.obs), + coredata(Ydet.obs)) > head(Ydet.obs) Date Ydet Yobs 1 2001-01-01 5314 5215 2 2002-01-01 5683 5585 3 2003-01-01 5783 5690 4 2004-01-01 5816 5730 5 2005-01-01 6168 6084 6 2006-01-01 6057 5982 
dput(Ydet.obs)and copy the output as code to your question.