How to create a matrix from an excel spreadsheet

Hello! I am new to R.
I am trying to create a matrix from an excel spreadsheet. It has more than one thousand rows and columns. I used "read_excel" and, right now, I am at a loss of what to do next.
Does anyone know how to proceed?

And what happened?

If you did something like:

aa  <-  read_excel("myfile.xlsx")

what happens if you do

print(aa)

If possible we need to see your code and some sample data from the Excel file.


Have a look at
https://forum.posit.co/t/faq-how-to-do-a-minimal-reproducible-example-reprex-for-beginners/23061.

Thank you for your reply!
Well, I learned how to create a matrix starting from vectors. Then I thought about making vectors in this case too. However, since the spreadsheet has so many rows and columns, I didn't believe it would solve my problem.

This is indeed basically what I did and, if I print it, R will only show the df.
I don't know if you can help me with this, but I thank you once again! :smiley:

You can convert the data frame to a matrix with as.matrix()

aa <- as.matrix(aa)

A matrix can only contain one data type, so if any of your data are character, the entire matrix will be characters.