## Visualize Station Performance

## Jeff Hebert
## 9/8/2016


library(data.table)

max_rows <- 100000

# Load just the data we need for time based visualization
cat("Reading just the data we need \n")
response <- fread("../input/train_numeric.csv", nrows = max_rows, select= "Response", showProgress = FALSE, data.table = FALSE)
dt_date <- fread("../input/train_date.csv", nrows = max_rows, showProgress = FALSE, data.table = FALSE)


# Investigate random set of stations

set.seed(123)
idx <- sample(ncol(dt_date), 20)

for(i in idx){
  if(sum(!is.na(dt_date[, i])) > 100){
    plot(dt_date[, i], jitter(response$Response), pch = "*",
         main = paste("Station ", names(dt_date)[i]),
         xlab = "timestamp", ylab = "failure")
  }
}

