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