# You can write R code here and then click "Run" to run it on our platform

library(readr)
library(ggplot2)
library(proto)


# The competition datafiles are in the directory ../input
# Read competition data files:
train <- read_csv("../input/train.csv")
test <- read_csv("../input/test.csv")



labels = train[,1]
features = train[,-1]
cat(sprintf("%f, %f\n", nrow(train), nrow(features)) )

cat(sprintf("Hello World!\n"))
# Write to the log:
cat(sprintf("Training set has %d rows and %d columns\n", nrow(train), ncol(train)))
cat(sprintf("Test set has %d rows and %d columns\n", nrow(test), ncol(test)))

# Generate output files with write_csv(), plot() or ggplot()
# Any files you write to the current directory get shown as outputs
head(train[1:10])

# Create a 28 * 28 matrix with pixel color values
m = matrix(unlist(train[10,-1]),nrow = 28, byrow = T)

#Plot that matrix
image(m, col=grey.colors(255))