ggplot: 2 facets with multiple lines

Viewed 2771

I'd like to have two horizontal facets with multiple lines for data similar to this:

         Date   variable      value
1  2016-08-04    sd6     0.01197055
2  2016-08-05    sd6     0.01188592
3  2016-08-08    sd6     0.01179797
4  2016-08-04   sd12     0.01263279
5  2016-08-05   sd12     0.01263080
6  2016-08-08   sd12     0.01263223
7  2016-08-04   sd24     0.01074460
8  2016-08-05   sd24     0.01074747
9  2016-08-08   sd24     0.01074515
10 2016-08-04  lcorr6    0.83422880
11 2016-08-05  lcorr6    0.83598720
12 2016-08-08  lcorr6    0.83666730
13 2016-08-04 lcorr12    0.83777470
14 2016-08-05 lcorr12    0.83803200
15 2016-08-08 lcorr12    0.83790820

Do I have to add another column to identify sd and lcorr or can I achieve this without doing so? The plot that I have in mind is something like:

enter image description here

Actual structure is:

structure(list(Date = structure(c(1L, 2L, 3L, 1L, 2L, 3L, 1L, 
2L, 3L, 1L, 2L, 3L, 1L, 2L, 3L), .Label = c("2016-08-04", "2016-08-05", 
"2016-08-08"), class = "factor"), variable = structure(c(1L, 
1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 4L, 4L, 4L, 5L, 5L, 5L), .Label = c("rollsd6", 
"rollsd12", "rollsd24", "rollcorr6", "rollcorr12"), class = "factor"), 
    value = c(0.011970547, 0.011885922, 0.011797967, 0.012632791, 
    0.012630795, 0.01263223, 0.010744599, 0.010747466, 0.010745155, 
    0.8342288, 0.8359872, 0.8366673, 0.8377747, 0.838032, 0.8379082
    )), row.names = c(NA, -15L), .Names = c("Date", "variable", 
"value"), class = "data.frame")
1 Answers
Related