Thank you Ivan. Basically, what I am being asked to do is to take the train.csv dataset, and store it in a data structure so that the data can be reshaped into a matrix of size 28 x 28, then I just need to print some indices of that (e.g. index 1, 2, 4, 7,, etc.)
I basically tried the following: dataframe_train <- array(read.csv(file_path_2, header=TRUE, stringsAsFactors = FALSE), 28, 28) then printing out several indices by doing (I know this could be done with a for loop better but I tried this): print(dataframe_train[1]) print(dataframe_train[2]) print(dataframe_train[4]) print(dataframe_train[7]) print(dataframe_train[8]) print(dataframe_train[9]) print(dataframe_train[11]) print(dataframe_train[12]) print(dataframe_train[17]) print(dataframe_train[22]) I am just unsure if I am achieving what is asked. Best regards, Paul El jue, 24 feb 2022 a las 13:25, Ivan Krylov (<krylov.r...@gmail.com>) escribió: > On Thu, 24 Feb 2022 13:12:16 -0500 > Paul Bernal <paulberna...@gmail.com> wrote: > > > dataframe_train <- as.matrix((read.csv(file_path_2, header=TRUE, > > stringsAsFactors = FALSE))) > > Have you removed the first column containing the labels? > > > dim(dataframe_train) <- c(28,28) > > This assumes that dataframe_train is a single 784-element vector. > Presumably, it's a whole matrix containing many such vectors as rows. > > > Would this do the work to reshape original dataset into a 28 x 28 > > matrix? > > Probably not. Use image() to plot a matrix and check. Wouldn't you want > the original dataset to consist of many such matrices, that is, a > three-way array? > > > When I print the original dataframe I get the message: > > [ reached getOption("max.print") -- omitted 41999 rows ] this only > > means that R will not pront the whole data, but is not trimming > > anything right? > > That's right. Use str() to examine objects. Most of them (except long > and/or deeply nested lists) should produce shorter output that's easier > to understand. > > -- > Best regards, > Ivan > [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.