我的数据集是来自 Kaggle的MNIST
我正在尝试使用该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
添加一些代码:
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