From 7738dcb24a3d984e70bed41c43b9111c6dcb692e Mon Sep 17 00:00:00 2001 From: Frederik Vanrenterghem Date: Sat, 8 Sep 2018 19:18:26 +0800 Subject: [PATCH] Convert to function. --- predictWebsiteHits.R | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/predictWebsiteHits.R b/predictWebsiteHits.R index 2a0d66e..415ab1e 100644 --- a/predictWebsiteHits.R +++ b/predictWebsiteHits.R @@ -1,15 +1,10 @@ -library(jsonlite) library(fable) library(tsibble) library(lubridate) library(ggplot2) -logfile <- file("data/photos.vanrenterghem.biz.access.kvp.log.1") - -apachelog <- stream_in(logfile) - -#apachelog$time <- gsub("\\[|\\]", "", apachelog$time) -apachelog %>% +createPlot <- function(x){ +x %>% mutate(time = gsub("\\[|\\]", "", time), time = dmy_hms(time), datehour = floor_date(time, unit = "hour") @@ -26,4 +21,4 @@ apachelog_tsbl %>% autoplot + ggtitle("Forecasting website hits using apache log only") + xlab("Date time") - +} \ No newline at end of file -- 2.39.5