This is a table. I want to create the equivalent but a spreadsheet. I installed the excelR package. I tried this as an example, but it didn't produce any output:
Can you explain more what you have in mind? It sounds like you want a pdf that looks like a spreadsheet. Does that mean something specific to you regarding formatting?
You should be able to do something like this to get a pdf with a table in it:
Yes I want something that looks like that. But how do I use my values from the table I made above instead of some random car data? Could you show me the equivalent spreadsheet for that table using kable?
It sounds like your underlying question is "how do I load tabular data into R?" There are many tutorials for many ways to do this. The best option will depend on how you have your data and what's most convenient.
It's worth noting that data frame variables in R are supposed to start with a letter or a dot, so you may get unexpected behavior if you try to name a column "1".
One convenient way to create a data frame, which can then be displayed in your markdown document, is to use the tribble function from the tibble package. The variable names should are preceded with a ~ symbol, but otherwise everything just gets a separating comma.
Thank you. This works quite well. Since it shows A and B at the top, how can I also do something similar for the very left of each row? Also, anything other than numbers are not allowed unfortunately.