Suppose that I have any generic table such as the following:
| Column 1 | Column 2 | Column 3 |
|----------|----------|----------|
| Row 1 | | |
| Row 2 | | |
| Row 3 | | |
How can I pull the row and columns into a vector in R without manually imputing them?
I tried c(table)
, where table
is the table name, but that didn´t give me the output I expected. I´m looking for the output of a vector containing, c(Row 1, Row 2, Row 3,...)
, in addition a vector containing c(Column 1, Column 2, Column 3,...)
.
I saw Converting a dataframe to a vector (by rows), but it creates a vector such as Column 1, Row 1, Column 2, Row 2
or vice versa, while I am looking for two seperate vectors.