My data set is the MNIST from Kaggle
I am trying to use the image
function to visualise say the first digit in the training set. Unfortunately I am getting the following error:
>image(1:28, 1:28, im, col=gray((0:255)/255))
Error in image.default(1:28, 1:28, im, col = gray((0:255)/255)) :
'z' must be numeric or logical
Adding a few codes:
rawfile<-read.csv("D://Kaggle//MNIST//train.csv",header=T) #Reading the csv file
im<-matrix((rawfile[1,2:ncol(rawfile)]), nrow=28, ncol=28) #For the 1st Image
image(1:28, 1:28, im, col=gray((0:255)/255))
Error in image.default(1:28, 1:28, im, col = gray((0:255)/255)) :
'z' must be numeric or logical
Error in x_train[idx, , , 1] : incorrect number of dimensions
, just replace that line by: im <- x_train[idx,,] – Buchan