0

I have this data frame below. I want to plot line graph using GGPLOT for each day of 'ind' column. In the 'ind'column I have the following dates repeated:

datedf<-as.Date(ux<-unique(df$ind))
> datedf
    [1] "07/12/2015" "08.12.2015" "09.12.2015" "10.12.2015" "11.12.2015" "12.14.2015" "2015-12- 15 "" 12.16.2015 "[9]" 12/17/2015 "," 12/18/2015 "," 12/21/2015 "

I want to make a line graph that has as Y-axis 'estimatedRate' and 'Future' columns data together and as X-axis the 'm' column for each one of these days.

> mdf<-ux<-unique(df$m)
> mdf
  [1]   21   42   63   84  105  126  147  168  189  210  231  252  273  294  315  336  357  378  399  420  441
 [22]  462  483  504  525  546  567  588  609  630  651  672  693  714  735  756  777  798  819  840  861  882
 [43]  903  924  945  966  987 1008 1029 1050 1071 1092 1113 1134 1155 1176 1197 1218 1239 1260 1281 1302 1323
 [64] 1344 1365 1386 1407 1428 1449 1470 1491 1512 1533 1554 1575 1596 1617 1638 1659 1680 1701 1722 1743 1764
 [85] 1785 1806 1827 1848 1869 1890 1911 1932 1953 1974 1995 2016 2037 2058 2079 2100 2121 2142 2163 2184 2205
[106] 2226 2247 2268 2289 2310 2331 2352 2373 2394 2415 2436 2457 2478 2499 2520

Notice that every 120 rows I have one day, and data related to this day in the columns 'estimatedRate' and 'Future'. To make the first graph I use the first 120 lines, to make the second graph the second 120th lines and so on.

           ind    m estimatedRate  Future
1   2015-12-07   21     0.1418127 0.1417730
2   2015-12-07   42     0.1420864 0.1427000
3   2015-12-07   63     0.1464147 0.1445127
4   2015-12-07   84     0.1494089 0.1463107
5   2015-12-07  105     0.1513357 0.1480558
6   2015-12-07  126     0.1526393 0.1499211
7   2015-12-07  147     0.1535730 0.1514676
8   2015-12-07  168     0.1542737 0.1531931
9   2015-12-07  189     0.1548187 0.1544670
10  2015-12-07  210     0.1552547 0.1555310
11  2015-12-07  231     0.1556115 0.1563341
12  2015-12-07  252     0.1559088 0.1569693
13  2015-12-07  273     0.1561603 0.1575226
14  2015-12-07  294     0.1563759 0.1581614
15  2015-12-07  315     0.1565628 0.1587338
16  2015-12-07  336     0.1567263 0.1591577
17  2015-12-07  357     0.1568706 0.1595782
18  2015-12-07  378     0.1569988 0.1599672
19  2015-12-07  399     0.1571136 0.1602606
20  2015-12-07  420     0.1572168 0.1603606
21  2015-12-07  441     0.1573103 0.1605000
22  2015-12-07  462     0.1573952 0.1606000
23  2015-12-07  483     0.1574728 0.1606000
24  2015-12-07  504     0.1575438 0.1606000
25  2015-12-07  525     0.1576092 0.1606000
26  2015-12-07  546     0.1576696 0.1606849
27  2015-12-07  567     0.1577255 0.1607000
28  2015-12-07  588     0.1577774 0.1607000
29  2015-12-07  609     0.1578258 0.1608000
30  2015-12-07  630     0.1578709 0.1608000
31  2015-12-07  651     0.1579131 0.1608000
32  2015-12-07  672     0.1579526 0.1608000
33  2015-12-07  693     0.1579898 0.1608000
34  2015-12-07  714     0.1580247 0.1607000
35  2015-12-07  735     0.1580577 0.1607000
36  2015-12-07  756     0.1580889 0.1607000
37  2015-12-07  777     0.1581183 0.1607000
38  2015-12-07  798     0.1581462 0.1606000
39  2015-12-07  819     0.1581727 0.1605000
40  2015-12-07  840     0.1581979 0.1604000
41  2015-12-07  861     0.1582218 0.1602935
42  2015-12-07  882     0.1582446 0.1602274
43  2015-12-07  903     0.1582663 0.1600911
44  2015-12-07  924     0.1582871 0.1600000
45  2015-12-07  945     0.1583069 0.1598089
46  2015-12-07  966     0.1583258 0.1596099
47  2015-12-07  987     0.1583440 0.1595128
48  2015-12-07 1008     0.1583614 0.1593824
49  2015-12-07 1029     0.1583781 0.1592110
50  2015-12-07 1050     0.1583941 0.1591128
51  2015-12-07 1071     0.1584095 0.1589000
52  2015-12-07 1092     0.1584243 0.1588000
53  2015-12-07 1113     0.1584385 0.1585936
54  2015-12-07 1134     0.1584522 0.1584613
55  2015-12-07 1155     0.1584654 0.1583922
56  2015-12-07 1176     0.1584782 0.1582099
57  2015-12-07 1197     0.1584905 0.1581000
58  2015-12-07 1218     0.1585023 0.1580000
59  2015-12-07 1239     0.1585138 0.1579000
60  2015-12-07 1260     0.1585249 0.1577715
61  2015-12-07 1281     0.1585356 0.1577000
62  2015-12-07 1302     0.1585460 0.1576000
63  2015-12-07 1323     0.1585560 0.1575767
64  2015-12-07 1344     0.1585658 0.1575000
65  2015-12-07 1365     0.1585752 0.1574936
66  2015-12-07 1386     0.1585844 0.1574277
67  2015-12-07 1407     0.1585932 0.1573908
68  2015-12-07 1428     0.1586018 0.1573000
69  2015-12-07 1449     0.1586102 0.1572916
70  2015-12-07 1470     0.1586183 0.1572000
71  2015-12-07 1491     0.1586262 0.1571940
72  2015-12-07 1512     0.1586339 0.1571319
73  2015-12-07 1533     0.1586414 0.1571000
74  2015-12-07 1554     0.1586486 0.1571000
75  2015-12-07 1575     0.1586557 0.1572000
76  2015-12-07 1596     0.1586626 0.1572000
77  2015-12-07 1617     0.1586693 0.1572093
78  2015-12-07 1638     0.1586758 0.1572731
79  2015-12-07 1659     0.1586822 0.1573000
80  2015-12-07 1680     0.1586884 0.1573000
81  2015-12-07 1701     0.1586945 0.1573000
82  2015-12-07 1722     0.1587004 0.1573101
83  2015-12-07 1743     0.1587061 0.1574000
84  2015-12-07 1764     0.1587118 0.1574000
85  2015-12-07 1785     0.1587173 0.1574000
86  2015-12-07 1806     0.1587226 0.1574000
87  2015-12-07 1827     0.1587279 0.1574000
88  2015-12-07 1848     0.1587330 0.1574000
89  2015-12-07 1869     0.1587380 0.1574000
90  2015-12-07 1890     0.1587429 0.1574000
91  2015-12-07 1911     0.1587477 0.1574000
92  2015-12-07 1932     0.1587524 0.1574092
93  2015-12-07 1953     0.1587570 0.1574731
94  2015-12-07 1974     0.1587615 0.1575000
95  2015-12-07 1995     0.1587659 0.1575000
96  2015-12-07 2016     0.1587702 0.1575000
97  2015-12-07 2037     0.1587744 0.1575000
98  2015-12-07 2058     0.1587785 0.1575000
99  2015-12-07 2079     0.1587825 0.1575000
100 2015-12-07 2100     0.1587865 0.1575000
101 2015-12-07 2121     0.1587904 0.1575000
102 2015-12-07 2142     0.1587942 0.1575000
103 2015-12-07 2163     0.1587979 0.1575000
104 2015-12-07 2184     0.1588016 0.1575000
105 2015-12-07 2205     0.1588052 0.1575000
106 2015-12-07 2226     0.1588087 0.1575000
107 2015-12-07 2247     0.1588122 0.1575000
108 2015-12-07 2268     0.1588156 0.1575000
109 2015-12-07 2289     0.1588189 0.1575000
110 2015-12-07 2310     0.1588222 0.1575018
111 2015-12-07 2331     0.1588254 0.1575385
112 2015-12-07 2352     0.1588286 0.1575746
113 2015-12-07 2373     0.1588317 0.1576190
114 2015-12-07 2394     0.1588347 0.1576846
115 2015-12-07 2415     0.1588377 0.1577000
116 2015-12-07 2436     0.1588406 0.1577000
117 2015-12-07 2457     0.1588435 0.1577000
118 2015-12-07 2478     0.1588464 0.1577131
119 2015-12-07 2499     0.1588492 0.1578000
120 2015-12-07 2520     0.1588519 0.1578000
121 2015-12-07   21     0.1418127 0.1417730
122 2015-12-07   42     0.1420864 0.1427000
123 2015-12-07   63     0.1464147 0.1445127
124 2015-12-07   84     0.1494089 0.1463107
125 2015-12-07  105     0.1513357 0.1480558
126 2015-12-07  126     0.1526393 0.1499211
127 2015-12-07  147     0.1535730 0.1514676
128 2015-12-07  168     0.1542737 0.1531931
129 2015-12-07  189     0.1548187 0.1544670
130 2015-12-07  210     0.1552547 0.1555310
131 2015-12-07  231     0.1556115 0.1563341
132 2015-12-07  252     0.1559088 0.1569693
133 2015-12-07  273     0.1561603 0.1575226
134 2015-12-07  294     0.1563759 0.1581614
135 2015-12-07  315     0.1565628 0.1587338
136 2015-12-07  336     0.1567263 0.1591577
137 2015-12-07  357     0.1568706 0.1595782
138 2015-12-07  378     0.1569988 0.1599672
139 2015-12-07  399     0.1571136 0.1602606
140 2015-12-07  420     0.1572168 0.1603606
141 2015-12-07  441     0.1573103 0.1605000
142 2015-12-07  462     0.1573952 0.1606000
143 2015-12-07  483     0.1574728 0.1606000
144 2015-12-07  504     0.1575438 0.1606000
145 2015-12-07  525     0.1576092 0.1606000
146 2015-12-07  546     0.1576696 0.1606849
147 2015-12-07  567     0.1577255 0.1607000
148 2015-12-07  588     0.1577774 0.1607000
149 2015-12-07  609     0.1578258 0.1608000
150 2015-12-07  630     0.1578709 0.1608000
151 2015-12-07  651     0.1579131 0.1608000
152 2015-12-07  672     0.1579526 0.1608000
153 2015-12-07  693     0.1579898 0.1608000
154 2015-12-07  714     0.1580247 0.1607000
155 2015-12-07  735     0.1580577 0.1607000
156 2015-12-07  756     0.1580889 0.1607000
157 2015-12-07  777     0.1581183 0.1607000
158 2015-12-07  798     0.1581462 0.1606000
159 2015-12-07  819     0.1581727 0.1605000
160 2015-12-07  840     0.1581979 0.1604000
161 2015-12-07  861     0.1582218 0.1602935
162 2015-12-07  882     0.1582446 0.1602274
163 2015-12-07  903     0.1582663 0.1600911
164 2015-12-07  924     0.1582871 0.1600000
165 2015-12-07  945     0.1583069 0.1598089
166 2015-12-07  966     0.1583258 0.1596099
167 2015-12-07  987     0.1583440 0.1595128
168 2015-12-07 1008     0.1583614 0.1593824
169 2015-12-07 1029     0.1583781 0.1592110
170 2015-12-07 1050     0.1583941 0.1591128
171 2015-12-07 1071     0.1584095 0.1589000
172 2015-12-07 1092     0.1584243 0.1588000
173 2015-12-07 1113     0.1584385 0.1585936
174 2015-12-07 1134     0.1584522 0.1584613
175 2015-12-07 1155     0.1584654 0.1583922
176 2015-12-07 1176     0.1584782 0.1582099
177 2015-12-07 1197     0.1584905 0.1581000
178 2015-12-07 1218     0.1585023 0.1580000
179 2015-12-07 1239     0.1585138 0.1579000
180 2015-12-07 1260     0.1585249 0.1577715
181 2015-12-07 1281     0.1585356 0.1577000
182 2015-12-07 1302     0.1585460 0.1576000
183 2015-12-07 1323     0.1585560 0.1575767
184 2015-12-07 1344     0.1585658 0.1575000
185 2015-12-07 1365     0.1585752 0.1574936
186 2015-12-07 1386     0.1585844 0.1574277
187 2015-12-07 1407     0.1585932 0.1573908
188 2015-12-07 1428     0.1586018 0.1573000
189 2015-12-07 1449     0.1586102 0.1572916
190 2015-12-07 1470     0.1586183 0.1572000
191 2015-12-07 1491     0.1586262 0.1571940
192 2015-12-07 1512     0.1586339 0.1571319
193 2015-12-07 1533     0.1586414 0.1571000
194 2015-12-07 1554     0.1586486 0.1571000
195 2015-12-07 1575     0.1586557 0.1572000
196 2015-12-07 1596     0.1586626 0.1572000
197 2015-12-07 1617     0.1586693 0.1572093
198 2015-12-07 1638     0.1586758 0.1572731
199 2015-12-07 1659     0.1586822 0.1573000
200 2015-12-07 1680     0.1586884 0.1573000
201 2015-12-07 1701     0.1586945 0.1573000
202 2015-12-07 1722     0.1587004 0.1573101
203 2015-12-07 1743     0.1587061 0.1574000
204 2015-12-07 1764     0.1587118 0.1574000
205 2015-12-07 1785     0.1587173 0.1574000
206 2015-12-07 1806     0.1587226 0.1574000
207 2015-12-07 1827     0.1587279 0.1574000
208 2015-12-07 1848     0.1587330 0.1574000
209 2015-12-07 1869     0.1587380 0.1574000
210 2015-12-07 1890     0.1587429 0.1574000
211 2015-12-07 1911     0.1587477 0.1574000
212 2015-12-07 1932     0.1587524 0.1574092
213 2015-12-07 1953     0.1587570 0.1574731
214 2015-12-07 1974     0.1587615 0.1575000
215 2015-12-07 1995     0.1587659 0.1575000
216 2015-12-07 2016     0.1587702 0.1575000
217 2015-12-07 2037     0.1587744 0.1575000
218 2015-12-07 2058     0.1587785 0.1575000
219 2015-12-07 2079     0.1587825 0.1575000
220 2015-12-07 2100     0.1587865 0.1575000
221 2015-12-07 2121     0.1587904 0.1575000
222 2015-12-07 2142     0.1587942 0.1575000
223 2015-12-07 2163     0.1587979 0.1575000
224 2015-12-07 2184     0.1588016 0.1575000
225 2015-12-07 2205     0.1588052 0.1575000
226 2015-12-07 2226     0.1588087 0.1575000
227 2015-12-07 2247     0.1588122 0.1575000
228 2015-12-07 2268     0.1588156 0.1575000
229 2015-12-07 2289     0.1588189 0.1575000
230 2015-12-07 2310     0.1588222 0.1575018
231 2015-12-07 2331     0.1588254 0.1575385
232 2015-12-07 2352     0.1588286 0.1575746
233 2015-12-07 2373     0.1588317 0.1576190
234 2015-12-07 2394     0.1588347 0.1576846
235 2015-12-07 2415     0.1588377 0.1577000
236 2015-12-07 2436     0.1588406 0.1577000
237 2015-12-07 2457     0.1588435 0.1577000
238 2015-12-07 2478     0.1588464 0.1577131
239 2015-12-07 2499     0.1588492 0.1578000
240 2015-12-07 2520     0.1588519 0.1578000
241 2015-12-07   21     0.1418127 0.1417730
242 2015-12-07   42     0.1420864 0.1427000
243 2015-12-07   63     0.1464147 0.1445127
244 2015-12-07   84     0.1494089 0.1463107
245 2015-12-07  105     0.1513357 0.1480558
246 2015-12-07  126     0.1526393 0.1499211
247 2015-12-07  147     0.1535730 0.1514676
248 2015-12-07  168     0.1542737 0.1531931
249 2015-12-07  189     0.1548187 0.1544670
250 2015-12-07  210     0.1552547 0.1555310
251 2015-12-07  231     0.1556115 0.1563341
252 2015-12-07  252     0.1559088 0.1569693
253 2015-12-07  273     0.1561603 0.1575226
254 2015-12-07  294     0.1563759 0.1581614
255 2015-12-07  315     0.1565628 0.1587338
256 2015-12-07  336     0.1567263 0.1591577
257 2015-12-07  357     0.1568706 0.1595782
258 2015-12-07  378     0.1569988 0.1599672
259 2015-12-07  399     0.1571136 0.1602606
260 2015-12-07  420     0.1572168 0.1603606
261 2015-12-07  441     0.1573103 0.1605000
262 2015-12-07  462     0.1573952 0.1606000
263 2015-12-07  483     0.1574728 0.1606000
264 2015-12-07  504     0.1575438 0.1606000
265 2015-12-07  525     0.1576092 0.1606000
266 2015-12-07  546     0.1576696 0.1606849
267 2015-12-07  567     0.1577255 0.1607000
268 2015-12-07  588     0.1577774 0.1607000
269 2015-12-07  609     0.1578258 0.1608000
270 2015-12-07  630     0.1578709 0.1608000
271 2015-12-07  651     0.1579131 0.1608000
272 2015-12-07  672     0.1579526 0.1608000
273 2015-12-07  693     0.1579898 0.1608000
274 2015-12-07  714     0.1580247 0.1607000
275 2015-12-07  735     0.1580577 0.1607000
276 2015-12-07  756     0.1580889 0.1607000
277 2015-12-07  777     0.1581183 0.1607000
278 2015-12-07  798     0.1581462 0.1606000
279 2015-12-07  819     0.1581727 0.1605000
280 2015-12-07  840     0.1581979 0.1604000
281 2015-12-07  861     0.1582218 0.1602935
282 2015-12-07  882     0.1582446 0.1602274
283 2015-12-07  903     0.1582663 0.1600911
284 2015-12-07  924     0.1582871 0.1600000
285 2015-12-07  945     0.1583069 0.1598089
286 2015-12-07  966     0.1583258 0.1596099
287 2015-12-07  987     0.1583440 0.1595128
288 2015-12-07 1008     0.1583614 0.1593824
289 2015-12-07 1029     0.1583781 0.1592110
290 2015-12-07 1050     0.1583941 0.1591128
291 2015-12-07 1071     0.1584095 0.1589000
292 2015-12-07 1092     0.1584243 0.1588000
293 2015-12-07 1113     0.1584385 0.1585936
294 2015-12-07 1134     0.1584522 0.1584613
295 2015-12-07 1155     0.1584654 0.1583922
296 2015-12-07 1176     0.1584782 0.1582099
297 2015-12-07 1197     0.1584905 0.1581000
298 2015-12-07 1218     0.1585023 0.1580000
299 2015-12-07 1239     0.1585138 0.1579000
300 2015-12-07 1260     0.1585249 0.1577715
301 2015-12-07 1281     0.1585356 0.1577000
302 2015-12-07 1302     0.1585460 0.1576000
303 2015-12-07 1323     0.1585560 0.1575767
304 2015-12-07 1344     0.1585658 0.1575000
305 2015-12-07 1365     0.1585752 0.1574936
306 2015-12-07 1386     0.1585844 0.1574277
307 2015-12-07 1407     0.1585932 0.1573908
308 2015-12-07 1428     0.1586018 0.1573000
309 2015-12-07 1449     0.1586102 0.1572916
310 2015-12-07 1470     0.1586183 0.1572000
311 2015-12-07 1491     0.1586262 0.1571940
312 2015-12-07 1512     0.1586339 0.1571319
313 2015-12-07 1533     0.1586414 0.1571000
314 2015-12-07 1554     0.1586486 0.1571000
315 2015-12-07 1575     0.1586557 0.1572000
316 2015-12-07 1596     0.1586626 0.1572000
317 2015-12-07 1617     0.1586693 0.1572093
318 2015-12-07 1638     0.1586758 0.1572731
319 2015-12-07 1659     0.1586822 0.1573000
320 2015-12-07 1680     0.1586884 0.1573000
321 2015-12-07 1701     0.1586945 0.1573000
322 2015-12-07 1722     0.1587004 0.1573101
323 2015-12-07 1743     0.1587061 0.1574000
324 2015-12-07 1764     0.1587118 0.1574000
325 2015-12-07 1785     0.1587173 0.1574000
326 2015-12-07 1806     0.1587226 0.1574000
327 2015-12-07 1827     0.1587279 0.1574000
328 2015-12-07 1848     0.1587330 0.1574000
329 2015-12-07 1869     0.1587380 0.1574000
330 2015-12-07 1890     0.1587429 0.1574000
331 2015-12-07 1911     0.1587477 0.1574000
332 2015-12-07 1932     0.1587524 0.1574092
333 2015-12-07 1953     0.1587570 0.1574731
334 2015-12-07 1974     0.1587615 0.1575000
335 2015-12-07 1995     0.1587659 0.1575000
336 2015-12-07 2016     0.1587702 0.1575000
337 2015-12-07 2037     0.1587744 0.1575000
338 2015-12-07 2058     0.1587785 0.1575000
339 2015-12-07 2079     0.1587825 0.1575000
340 2015-12-07 2100     0.1587865 0.1575000
341 2015-12-07 2121     0.1587904 0.1575000
342 2015-12-07 2142     0.1587942 0.1575000
343 2015-12-07 2163     0.1587979 0.1575000
344 2015-12-07 2184     0.1588016 0.1575000
345 2015-12-07 2205     0.1588052 0.1575000
346 2015-12-07 2226     0.1588087 0.1575000
347 2015-12-07 2247     0.1588122 0.1575000
348 2015-12-07 2268     0.1588156 0.1575000
349 2015-12-07 2289     0.1588189 0.1575000
350 2015-12-07 2310     0.1588222 0.1575018
351 2015-12-07 2331     0.1588254 0.1575385
352 2015-12-07 2352     0.1588286 0.1575746
353 2015-12-07 2373     0.1588317 0.1576190
354 2015-12-07 2394     0.1588347 0.1576846
355 2015-12-07 2415     0.1588377 0.1577000
356 2015-12-07 2436     0.1588406 0.1577000
357 2015-12-07 2457     0.1588435 0.1577000
358 2015-12-07 2478     0.1588464 0.1577131
359 2015-12-07 2499     0.1588492 0.1578000
360 2015-12-07 2520     0.1588519 0.1578000
361 2015-12-08   21     0.1418127 0.1419048
362 2015-12-08   42     0.1420864 0.1429000
363 2015-12-08   63     0.1464147 0.1446142
364 2015-12-08   84     0.1494089 0.1465071
365 2015-12-08  105     0.1513357 0.1483599
366 2015-12-08  126     0.1526393 0.1501925
367 2015-12-08  147     0.1535730 0.1517595
368 2015-12-08  168     0.1542737 0.1534194
369 2015-12-08  189     0.1548187 0.1547000
370 2015-12-08  210     0.1552547 0.1557739
371 2015-12-08  231     0.1556115 0.1566678
372 2015-12-08  252     0.1559088 0.1573265
373 2015-12-08  273     0.1561603 0.1579527
374 2015-12-08  294     0.1563759 0.1585816
375 2015-12-08  315     0.1565628 0.1590505
376 2015-12-08  336     0.1567263 0.1595437
377 2015-12-08  357     0.1568706 0.1598891
378 2015-12-08  378     0.1569988 0.1602782
379 2015-12-08  399     0.1571136 0.1605000
380 2015-12-08  420     0.1572168 0.1606000
381 2015-12-08  441     0.1573103 0.1607000
382 2015-12-08  462     0.1573952 0.1607000
383 2015-12-08  483     0.1574728 0.1607000
384 2015-12-08  504     0.1575438 0.1607000
385 2015-12-08  525     0.1576092 0.1607000
386 2015-12-08  546     0.1576696 0.1607918
387 2015-12-08  567     0.1577255 0.1608000
388 2015-12-08  588     0.1577774 0.1608000
389 2015-12-08  609     0.1578258 0.1609000
390 2015-12-08  630     0.1578709 0.1609000
391 2015-12-08  651     0.1579131 0.1609000
392 2015-12-08  672     0.1579526 0.1608000
393 2015-12-08  693     0.1579898 0.1608000
394 2015-12-08  714     0.1580247 0.1607000
395 2015-12-08  735     0.1580577 0.1607000
396 2015-12-08  756     0.1580889 0.1606267
397 2015-12-08  777     0.1581183 0.1606000
398 2015-12-08  798     0.1581462 0.1605051
399 2015-12-08  819     0.1581727 0.1604000
400 2015-12-08  840     0.1581979 0.1603816
401 2015-12-08  861     0.1582218 0.1602903
402 2015-12-08  882     0.1582446 0.1602243
403 2015-12-08  903     0.1582663 0.1600733
404 2015-12-08  924     0.1582871 0.1598907
405 2015-12-08  945     0.1583069 0.1597000
406 2015-12-08  966     0.1583258 0.1595000
407 2015-12-08  987     0.1583440 0.1593170
408 2015-12-08 1008     0.1583614 0.1591760
409 2015-12-08 1029     0.1583781 0.1590000
410 2015-12-08 1050     0.1583941 0.1589085
411 2015-12-08 1071     0.1584095 0.1587916
412 2015-12-08 1092     0.1584243 0.1585949
413 2015-12-08 1113     0.1584385 0.1584872
414 2015-12-08 1134     0.1584522 0.1583551
415 2015-12-08 1155     0.1584654 0.1582845
416 2015-12-08 1176     0.1584782 0.1582000
417 2015-12-08 1197     0.1584905 0.1580916
418 2015-12-08 1218     0.1585023 0.1579944
419 2015-12-08 1239     0.1585138 0.1578938
420 2015-12-08 1260     0.1585249 0.1577655
421 2015-12-08 1281     0.1585356 0.1577000
422 2015-12-08 1302     0.1585460 0.1577000
423 2015-12-08 1323     0.1585560 0.1576690
424 2015-12-08 1344     0.1585658 0.1576000
425 2015-12-08 1365     0.1585752 0.1576000
426 2015-12-08 1386     0.1585844 0.1576000
427 2015-12-08 1407     0.1585932 0.1576000
428 2015-12-08 1428     0.1586018 0.1575832
429 2015-12-08 1449     0.1586102 0.1575000
430 2015-12-08 1470     0.1586183 0.1575000
431 2015-12-08 1491     0.1586262 0.1575000
432 2015-12-08 1512     0.1586339 0.1575000
433 2015-12-08 1533     0.1586414 0.1575000
434 2015-12-08 1554     0.1586486 0.1574944
435 2015-12-08 1575     0.1586557 0.1574000
436 2015-12-08 1596     0.1586626 0.1574000
437 2015-12-08 1617     0.1586693 0.1574000
438 2015-12-08 1638     0.1586758 0.1574000
439 2015-12-08 1659     0.1586822 0.1574000
440 2015-12-08 1680     0.1586884 0.1574000
441 2015-12-08 1701     0.1586945 0.1573832
442 2015-12-08 1722     0.1587004 0.1573000
443 2015-12-08 1743     0.1587061 0.1573000
444 2015-12-08 1764     0.1587118 0.1573000
445 2015-12-08 1785     0.1587173 0.1573000
446 2015-12-08 1806     0.1587226 0.1573000
447 2015-12-08 1827     0.1587279 0.1573000
448 2015-12-08 1848     0.1587330 0.1572832
449 2015-12-08 1869     0.1587380 0.1572000
450 2015-12-08 1890     0.1587429 0.1572000
451 2015-12-08 1911     0.1587477 0.1572000
452 2015-12-08 1932     0.1587524 0.1572000
453 2015-12-08 1953     0.1587570 0.1572000
454 2015-12-08 1974     0.1587615 0.1572000
455 2015-12-08 1995     0.1587659 0.1571869
456 2015-12-08 2016     0.1587702 0.1571191
457 2015-12-08 2037     0.1587744 0.1571000
458 2015-12-08 2058     0.1587785 0.1571000
459 2015-12-08 2079     0.1587825 0.1571000
460 2015-12-08 2100     0.1587865 0.1571000
461 2015-12-08 2121     0.1587904 0.1571000
462 2015-12-08 2142     0.1587942 0.1571000
463 2015-12-08 2163     0.1587979 0.1570481
464 2015-12-08 2184     0.1588016 0.1570000
465 2015-12-08 2205     0.1588052 0.1570000
466 2015-12-08 2226     0.1588087 0.1570000
467 2015-12-08 2247     0.1588122 0.1570000
468 2015-12-08 2268     0.1588156 0.1570000
469 2015-12-08 2289     0.1588189 0.1570000
470 2015-12-08 2310     0.1588222 0.1570000
471 2015-12-08 2331     0.1588254 0.1570000
472 2015-12-08 2352     0.1588286 0.1570000
473 2015-12-08 2373     0.1588317 0.1570000
474 2015-12-08 2394     0.1588347 0.1570000
475 2015-12-08 2415     0.1588377 0.1570000
476 2015-12-08 2436     0.1588406 0.1570000
477 2015-12-08 2457     0.1588435 0.1570000
478 2015-12-08 2478     0.1588464 0.1570000
479 2015-12-08 2499     0.1588492 0.1570000
480 2015-12-08 2520     0.1588519 0.1570000
481 2015-12-09   21     0.1418127 0.1419000
482 2015-12-09   42     0.1420864 0.1429698
483 2015-12-09   63     0.1464147 0.1447095
484 2015-12-09   84     0.1494089 0.1464277
485 2015-12-09  105     0.1513357 0.1482057
...
22437 2015-12-21 2457     0.1660790 0.1639335
22438 2015-12-21 2478     0.1660834 0.1639000
22439 2015-12-21 2499     0.1660878 0.1638653
22440 2015-12-21 2520     0.1660921 0.1638000

...

I'm trying to make a 'for' or a function that gives me line graphs for EACH day. But this very complicated as im begginer in R.

What I got so far was plot the graph of the columns 'estimatedRate' and 'Future' together.

ggplot(data=df, aes(x=df$m, y=df$DiFuturo, colour=ind))+ 
  xlab('Vértices') + ylab('Taxas')+
  theme(legend.title=element_blank(), legend.position='top') +
  ggtitle('Curvas de DI1')+ 
  geom_point()+ geom_line()+
  geom_point(aes(x=df$m,y = df$estimatedRate,colour=ind)) +
  geom_point(y = df$estimatedRate, color="black")+
  geom_line(y = df$estimatedRate, color="blue")+
  theme(axis.text = element_text(size = 12,colour="black"),axis.text.x=element_text(angle = 45))

But I would like separated line graphs. In the end I would end up with 11 charts.

Could you give me a hint?

  • 1
    you could create a new column that would create blocks of 121 rows....first 121 block A, next 121 rows block B....and so on and then you could split your dataset or you could use facet_grid or facet_wrap to plot by blocks – MLavoie Dec 24 '15 at 18:41
  • Thanks! I dont know how to do this. I will study. I think facet_wrap could help me i am looking into this now. Thanks –  Dec 24 '15 at 18:44
  • so you know how many blocks of 121 rows you have, right? here is an example for a vector but you can adjust it for a dataset. just run this example and I think you will undertsand what I mean x <- factor(LETTERS[1:4]); names(x) <- letters[1:4]; rep(x, 2) – MLavoie Dec 24 '15 at 18:46
  • For making separate plots per group in ggplot2, see [this question](http://stackoverflow.com/questions/19146665/how-subset-a-data-frame-by-a-factor-and-repeat-a-plot-for-each-subset) as well as [this](http://stackoverflow.com/questions/34191346/looping-in-r-to-create-many-plots-when-you-have-one-extra-variable?lq=1) – aosmith Dec 24 '15 at 18:58

1 Answers1

0

I am not sure if I understand correctly but I hope it will help.

I took a subset of your dataset

df <- structure(list(ind = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L), .Label = "2015-12-07", class = "factor"), m = c(21L, 
42L, 63L, 21L, 42L, 63L, 21L, 42L, 63L), estimatedRate = c(0.1418127, 
0.1420864, 0.1464147, 0.1494089, 0.1513357, 0.1526393, 0.153573, 
0.1542737, 0.1548187), Future = c(0.141773, 0.1427, 0.1445127, 
0.1463107, 0.1480558, 0.1499211, 0.1514676, 0.1531931, 0.154467
), Blocks = structure(c(1L, 2L, 3L, 1L, 2L, 3L, 1L, 2L, 3L), class = "factor", .Label = c("A", 
"B", "C"))), .Names = c("ind", "m", "estimatedRate", "Future", 
"Blocks"), row.names = c("1", "2", "3", "4", "5", "6", "7", "8", 
"9"), class = "data.frame")

a create a new column for block

x <- factor(LETTERS[1:3]); names(x) <- letters[1:3]
df$Blocks <- rep(x, each=3)
df

and then plot

ggplot(data=df, aes(x=m, y=Future, colour=Blocks))+ 
  xlab('Vértices') + ylab('Taxas')+
  theme(legend.title=element_blank(), legend.position='top') +
  ggtitle('Curvas de DI1')+ 
  geom_point()+ geom_line()+
  geom_point(aes(x=m, y = estimatedRate,colour=ind)) +
  geom_point(y = df$estimatedRate, color="black")+
  geom_line(y = df$estimatedRate, color="blue")+
  theme(axis.text = element_text(size = 12,colour="black"),axis.text.x=element_text(angle = 45)) + facet_grid(Blocks~.)

it gives enter image description here

MLavoie
  • 9,671
  • 41
  • 36
  • 56