[R] Pixel Image Reshaping using R
Ivan Krylov
kry|ov@r00t @end|ng |rom gm@||@com
Thu Feb 24 19:25:43 CET 2022
On Thu, 24 Feb 2022 13:12:16 -0500
Paul Bernal <paulbernal07 using 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
More information about the R-help
mailing list