# 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
library(dplyr)
library(reshape2)
# 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")
#system("ls ../input/test")
#system("ls ../input/train")

setwd('../input')
driver_imgs_list <- read_csv('driver_imgs_list.csv')
head(driver_imgs_list)
dim(driver_imgs_list)

driver_imgs_list %>% group_by(subject) %>% summarise(n=length(img))
driver_imgs_list %>% group_by(classname) %>% summarise(n=length(img))

Smry_Counts <- driver_imgs_list %>% group_by(subject,classname) %>% summarise(n=length(img))

dcast(Smry_Counts,subject ~classname,value.var="n")

#sample_submission <- read_csv('sample_submission.csv')
#head(sample_submission)
# Any results you write to the current directory are saved as output.


