Re: [R] Pixel Image Reshaping using R

2022-02-24 Thread Ivan Krylov
On Thu, 24 Feb 2022 13:31:09 -0500 Paul Bernal wrote: > 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,

Re: [R] Pixel Image Reshaping using R

2022-02-24 Thread Paul Bernal
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: d

Re: [R] Pixel Image Reshaping using R

2022-02-24 Thread Paul Bernal
Dear Ivan, this is what I did: dataframe_train <- as.matrix((read.csv(file_path_2, header=TRUE, stringsAsFactors = FALSE))) dim(dataframe_train) <- c(28,28) The file I read was the one I attached in the first email. Would this do the work to reshape original dataset into a 28 x 28 matrix? When I p

Re: [R] Pixel Image Reshaping using R

2022-02-24 Thread Sarah Goslee
Hi Paul, I may be missing something, but you can transform a vector to a matrix of any desired size by using matrix(). For more nuanced processing of images, you might look into one of the many image processing packages in R, or even the raster package (or the newer terra). Sarah On Thu, Feb 24

Re: [R] Pixel Image Reshaping using R

2022-02-24 Thread Ivan Krylov
On Thu, 24 Feb 2022 11:00:08 -0500 Paul Bernal wrote: > Each pixel column in the training set has a name like pixel x, where > x is an integer between 0 and 783, inclusive. To locate this pixel on > the image, suppose that we have decomposed x as x = i ∗ 28 + j, where > i and j are integers betwe