View source: R/crosstabToCases.R
crosstabToCases | R Documentation |
Convert a table of crosstabulated counts into a data frame of cases.
crosstabToCases(x)
x |
a matrix or table of frequencies representing a crosstabulation. |
Returns a data frame of cases.
Nick Barrowman, based on the countsToCases
function at http://www.cookbook-r.com/Manipulating_data/Converting_between_data_frames_and_contingency_tables/#countstocases-function
# The Titanic data set is in the datasets package.
# Convert it from a 4 x 2 x 2 x 2 crosstabulation
# to a 4-column data frame of 2201 individuals
titanic <- crosstabToCases(Titanic)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.