# 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(data.table) # data.table facilities
# 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")


# reading the grid dataset
grid <- fread(input = "../input/grid_sizes.csv")

# number of images by levels of Xmax and Ymin values
occ <- grid[,.(occ = .N),by=c("Xmax","Ymin")]

# see head
head(occ)

# writing the results as csv
fwrite(occ, "./occurences_grid.csv")