]> git.vanrenterghem.biz Git - R/project-using-kafka-in-R.git/blob - predictWebsiteHits.R
4c2d65ccd7966743999f5659c5c0972668581c45
[R/project-using-kafka-in-R.git] / predictWebsiteHits.R
1 library(jsonlite)
2 library(fable)
3 library(tsibble)
4 library(lubridate)
6 logfile <- file("data/photos.vanrenterghem.biz.access.kvp.log")
8 apachelog <- stream_in(logfile)
10 #apachelog$time <- gsub("\\[|\\]", "", apachelog$time)
11 apachelog %>%
12   mutate(time = gsub("\\[|\\]", "", time),
13            time = dmy_hms(time)) %>%
14   group_by(time) %>%
15   summarise(hits = n()) ->
16   apachelog
18 as.tsibble(apachelog, index = time)