b <- read.csv(file = "~/Downloads/slackoverflow-psycho.csv")
b <- b[,1:3]

b$DAYSTAMP <- as.Date(b$DAYSTAMP, format = "%Y-%m-%d")

Calculate moving average over previous and past 10 days

# Smoothed symmetrically:
# average of current sample, 10 future samples, and 10 past samples
f21 <- rep(1/15,15)
b$`moving average` <- filter(b$VALUE, f21, sides = 2, circular = T)
p <- ggplot(data = subset(b, VALUE > 0), aes(DAYSTAMP)) + 
  geom_line(aes(y=VALUE, colour="Raw Data")) +
  geom_line(aes(y=`moving average`, colour="Moving avg.")) +
  scale_y_continuous(breaks=seq(0,20, 2.5))+
  ylab('Hours') + 
  xlab('Date') + 
  ggtitle("Very productiv & productive time on the laptop (2016)") + 
  theme(plot.title = element_text(hjust = 0.5, face="bold"), legend.title=element_blank())

ggplotly(p)
#svg("~/Downloads/rescuetime.svg")
#p
#dev.off()