# This R environment comes with all of CRAN preinstalled, as well as many other helpful packages
# The environment is defined by the kaggle/rstats docker image: https://github.com/kaggle/docker-rstats
# For example, here's several helpful packages to load in 

library(ggplot2) # Data visualization
library(readr) # CSV file I/O, e.g. the read_csv function

# Input data files are available in the "../input/" directory.
# For example, running this (by clicking run or pressing Shift+Enter) will list the files in the input directory

system("ls ../input")

# Any results you write to the current directory are saved as output.

library(data.table)
library(dplyr)
library(ggplot2)
library(knitr)

print("Reading data")
#train <- fread('../input/train.csv',select = c('Producto_ID','Demanda_uni_equil'))
#train = read.csv("../input/train.csv", colClasses=c("NULL",	"NULL",	"NULL",	"NULL",	"NULL", "NULL",	"NULL",	"NULL",	"NULL",	"NULL",	NA))

train = fread("../input/train.csv",
              select = c("Agencia_ID", "Canal_ID", "Ruta_SAK",
                         "Cliente_ID", "Producto_ID", "Demanda_uni_equil"),
              colClasses = c(Semana = "numeric", Agencia_ID = "numeric",
                             Canal_ID = "numeric", Ruta_SAK = "numeric",
                             Cliente_ID = "numeric", Producto_ID = "numeric",
                             Demanda_uni_equil = "numeric"))

# install.packages("corrplot")
library(corrplot)
print('cor')
cortrain <- cor(train)
cortrain
print('plot')
corrplot(cortrain, method="color")



    



