ggplot2 - R: calculate and superimpose on a ggplot graph minute-based totals for an event series -


Consider a data frame df from a web server access log, with two fields ( Sample below, period is in milliseconds and to make the example easier, let's ignore the date).

  Time, Duration 18: 17: 26.552,8 18: 17: 26.632,10 18:17: 26.681,12 18: 17: 26.733,4 18: 17: 26.778,5 18: 17: 26.832,5 18: 17: 26.889,4 18: 17: 26.931,3: 18: 17: 26.9 9 3 18: 17: 27.040, 5 18: 17: 27.157,4 18: 17: 27.20 9,14 18: 17: 27.249,4 18: 17: 27.303,418 18: 17: 27.408,13 18: 17: 27,450, 3 18: 17: 27.506,13 18: 17: 27.546,3 18: 17 : 27.616,4 18: 17: 27.664,4 18: 17: 27.718,3 18: 17: 27.796,10 18: 17: 27.856,3 to 18: 17: 27,90 9,3 18: 17: 27.974,3 18 : 17: 28.029,3  

qplot (time, duration, data = df); gives me a graph of the period I want to add the number of requests for each minute to a line to be displayed. Ideally, this line will have a point point in one minute: 30sec point if it is very complex, then an acceptable option is a phase line with the same value (number of requests) in one minute.

One way is to trunc (df $ time, units = C ("mins")) , then calculate the request per minute in a new column, then graph it.

I'm asking what is, perhaps, more direct way to thank you for completing the above.

The following may be useful: Create a data frame with steps and plots:

  time duration sec sec 2 diffsec2 step30s Step 1 18: 17: 26.552 8 26.552 552 0 2 2 18: 17: 26.632 10 26.632 632 80 1 1 3 18: 17: 26.681 12 26.681 681 49 0 4 18: 17 : 26.733 4 26.733 733 52 1 1 5 18: 17: 26.778 5 26.778 778 45 6 6: 18: 17: 26.832 5 26.832 832 54 1 1 7 18: 17: 26.889 4 26.889 88 9 57 1 2 8 18: 17: 26 9 31 3 26.931 931 42 9 9: 17: 26.9 9 3 3 26.9 9 1 60 1 1 10 18: 17: 27.040 5 27.040 040-9 51 11 11 18 18: 17: 27.157 4 27.157 157 117 1 1 12 18 : 17: 27.20 9 14 27.20 9 20 9 52 1 2 13 18: 17: 27.249 4 27.249 24 9 40 0 ​​14 14 18: 17: 27.303 4 27.303 303 54 1 1 15 18:17: 27.356 13 27.356 356 53 1 2 16 18: 17: 27.408 13 27.408 408 52 1 3 17 18: 17: 27.450 3 27.450 450 42 0 18 1 8: 17: 27.506 13 27.506 506 56 1 9 18: 17: 27.546 3 27.546 546 40 0 ​​20 18: 17: 27.616 4 27.616 616 70 1 1 21 18: 17: 27.664 4 27.664 664 48 22 22 18: 17 : 27.718 3 27.718 718 54 1 1 23 18: 17: 27.796 10 27.796 796 78 1 2 24 18: 17: 27.856 3 27.856 856 60 1 3 25 18: 17: 27.90 9 3 27.90 9 90 53 1 4 26 18: 17: 27.974 3 27.974 9 74 65 1 5 27 18: 17: 28.029 3 28.029 02 9-945 0 0> & Gt; Ggplot (ddf) + geom_point (aes (x = time, y = period)) + geom_line (AES (x = time, y = step, group = 1), color = 'red')  

Enter image details here


Comments

Popular posts from this blog

winforms - C# Form - Property Change -

java - Messages from .properties file do not display UTF-8 characters -

javascript - amcharts makechart not working -