# data.table way this stuff feels faster than dplyr but isn't very FP when using := methods
# alternatively, use the .() aka list() feature and create a new table. Still faster than dplyr or plyr
#
https://mran.microsoft.com/web/packages/data.table/vignettes/datatable-intro.html
library(data.table) # for fread and other data.table functions
library(tidyverse) # for as_tibble to feed into ggplot
library(lubridate) # for round_date
library(fasttime) # for fastPOSIXct
dtER=fread("c:/kewoo/eai/EXCEPTIONREC.d20171206.csv")
AESTDiff <- 36000
interval.length <- "1 seconds"
# exploratory
str(dtER)
nrow(dtER)
names(dtER)
dtER[,.(TIME_STAMP, APPLICATIONID)]
# end exploration
dtER[,T1S := round_date(fastPOSIXct(TIME_STAMP)-AESTDiff, interval.length)]
dtER[,.(TIME_STAMP, T1S, APPLICATIONID)]
tb01.all <- dtER[, .(.N), by=.(T1S)] %>% as_tibble()
tb01.AC <- dtER[APPLICATIONID == "AcurityConnector", .(.N), by=.(T1S)] %>% as_tibble()
tb01.identity <- dtER[APPLICATIONID == "Identity", .(.N), by=.(T1S)] %>% as_tibble()
tb01.all
ggplot() +
geom_jitter(data=tb01.all, aes(x=T1S,y=N), color='blue') +
geom_jitter(data=tb01.identity, aes(x=T1S,y=N), color='red')
tb02.all <- dtER[, .(.N), by=.(T1S, APPLICATIONID)] # %>% as_tibble()
ggplot(tb02.all, aes(T1S, fill = APPLICATIONID)) +
geom_histogram(binwidth = 1440) +
scale_fill_brewer(palette="Set1")
ggplot(tb02.all, aes(T1S, colour = APPLICATIONID)) +
geom_freqpoly(binwidth = 1440)