I have the following time series data (only samlpe given here):
df
Month repo revrepo bankrate CRR Callrate WPI GDP FED width nse usd
1 2001-04-01 9.00 6.75 7.0 8.00 7.49 5.41 4.6 4.50 225 1125.2 46.79
2 2001-05-01 8.75 6.50 7.0 7.50 8.03 5.60 4.6 4.00 225 1167.9 46.92
3 2001-06-01 8.50 6.50 7.0 7.50 7.24 5.30 4.6 3.75 200 1107.9 47.00
4 2001-07-01 8.50 6.50 7.0 7.50 7.19 5.23 5.3 3.75 200 1072.8 47.14
5 2001-08-01 8.50 6.50 7.0 7.50 6.94 5.41 5.3 3.50 200 1053.8 47.13
6 2001-09-01 8.50 6.50 7.0 7.50 7.30 4.52 5.3 3.00 200 913.9 47.65
7 2001-10-01 8.50 6.50 6.5 7.50 7.40 2.91 6.8 2.50 200 971.9 48.02
8 2001-11-01 8.50 6.50 6.5 5.75 6.97 2.59 6.8 2.00 200 1067.2 48.00
9 2001-12-01 8.50 6.50 6.5 5.50 7.08 2.08 6.8 1.75 200 1059.0 47.92
10 2002-01-01 8.50 6.50 6.5 5.50 6.63 1.51 6.4 1.75 200 1075.4 48.32
11 2002-02-01 8.50 6.50 6.5 5.50 6.73 1.39 6.4 1.75 200 1142.0 48.69
12 2002-03-01 8.00 6.00 6.5 5.50 6.97 1.76 6.4 1.75 200 1129.5 48.74
13 2002-04-01 8.00 6.00 6.5 5.50 6.58 1.50 5.1 1.75 200 1084.5 48.92
14 2002-05-01 8.00 6.00 6.5 5.50 6.90 1.56 5.1 1.75 200 1028.8 49.00
15 2002-06-01 8.00 5.75 6.5 5.00 6.04 2.43 5.1 1.75 225 1057.8 48.97
I am trying to plot each variable using ggplot as shown below (only first variable plot shown as example):
ts_data<-df
ts_data$Month<-as.Date(ts_data$Month,"%Y-%m-%d")
library(ggplot2)
library(ggthemes)
p <- ggplot() +
geom_line(data = ts_data, aes(x=Month, y=repo, color = "repo"),size=1.45,colour="#0072B2") +ylim(0,12) +labs(color="") + xlab('\nYears') + ylab('Repo Rates (%)\n') + scale_x_date(date_breaks = "2 year",date_labels = "%Y")+ggtitle("Repo Rate movement from 2001 April to 2016 April") + theme(axis.text.x=element_text(size=12, color = "black")) + theme_stata()
p
I can similarly plot all the other remaining variables but to be efficient, one can go for iterative method. How can i plot all the variables iteratively with the plot title as well as yaxis title changing with each iteration. Thanks in advance.
