unxtab | R Documentation |
Convert a table from crosstab format to long format.
unxtab(x, labels = c("Year", "Age", "Value"))
x |
a crosstab table (data frame, matrix, or table) with descriptive row names and column names. |
labels |
a vector of three strings, used as column names for the resulting data frame. |
Data frame in long format (3 columns) that can be crosstabbed to look like
x
.
Use dimnames like "1990"
instead of "Year1990"
to end up with
numeric entries in resulting data frame.
Another approach is as.data.frame(as.table(as.matrix(x)))
.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.