r - How to complete a graph ggplot2 -
I am doing a graph to show a number of hits on some websites. I have the following data frame:
Time 1 time 2 citio hit time 1 2014-4-11 8: 0 Gmail 1 2014-04-11 08:00:00 2 2014-4- 11 8: 0 Google 18 2014-04-11 08:00:00 3 2014-4-11 8: 0 Twitter 4 2014-04-11 08:00:00 4 2014-4-11 8: 0 Facebook 13 2014- 04 -11 08:00:00 5 2014-4-11 8: 0 Youtube 110 2014-04-11 08:00:00 6 2014-4-11 8: 0 MediaWidcom.com 3 2014-04-11 08: 00 : 00 7 2014-4-11 8: 0 Grooveshark.com 4 2014-04-11 08:00:00 8 2014-4-11 8: 0 teleconlanparty.org 20 2014-04-11 08:00:00 9 2014 -4-11 7:56 Twitter 2 2014-04-11 07:56:00 10 2014-4-11 7:56 Facebook 6 2014-04-11 07:56:00 11 2014-4-11 7:56 Youtube .com 8 2014-04-11 07:56:00 12 2014-4-11 7:56 Teleconprotterjorg 11 2014-04-11 07:56:00 13 2014-4-11 7:57 GMail 36 2014- 04-11 07:57:00 14 2014-4-11 7:57 Google 1 2014-04-11 07:57:00 15 2014-4-11 7:57 Twitter 79 2014-04-11 07:57:00 16 2014-4-11 7:57 Facebook 194 2014-04-11 07:57:00 17 2014-4-11 7:57 series.li 2 2014-04-11 07:57:00 18 2014-4-11 7:57 Hotmail dot com 81 2014- 04-11 07:57: 00 19 2014-4-11 7:57 Meneame.com 4 2014-04-11 07:57:00 20 2014-4-11 7:57 Youtube.com 174-04-04 07 : 57: 00 21 2014- 4-11 7:57 MediaWidcom.com 12 2014-04-11 07:57:00 22 2014-04-11 7:57 Teleconpterology 95 2014-04-11 07:57:00 23 2014 -4-11 7:58 58 Gmail 34 2014-04-11 07:58:00 24 2014-4-11 7:58 Google 13 2014-04-11 07:58:00 25 2014-4-11 7:58 Twitter 83 2014-04- 11 07:58:00 26 2014-4-11 7:58 facebook 99 2014-04-11 07:58:00 27 2014-4-11 7:58 chain.li 2 2014-04-11 07:58:00 28 2014-4-11 7:58 hotmail dot com 5 2014-04-11 07:58:00 29 2014-4-11 7:58 Meneame.com 1 2014-04-11 07:58:00 30 2014-4 -11 7:58 Youtube.com 247 2014-04-11 07:58:00
< / Pre>I'm doing a graph that has a line in every web:
ggplot (TrafWave, AES (time, hit, color = sit)) + geom_line ()! [Incom Peptue representation] [1]
But some websites are not visited every minute so they are sometimes not defined I would like to assign 0 when the website is one minute Not to be seen. In this way, I can graph properly.
Thanks for helping !!!
You must make changes before trying a plot. You can create a list of sites every time and merge them to make missing rows. For example (suppose your time column is a proper POSIXct time range)
all time < -seq (minimum (TrafoWeb $ Time), Max (TrafoWeb $ Time), = "1 minute") Mm & lt; -marge (TrafWave, Extension Grid (Citio = Exclusive (TrafficWeb $ Citio), Time = All Time), all.y = T) mm $ hit [is.na (mm $ hit)] <-0
Then only conspiracy with
ggplot (mm, aes (time, hit, color = sit)) + geom_line ()
Comments
Post a Comment