mr_stack | R Documentation |
Creates a data frame where every observation has as many rows as it has levels present, plus an id column to specify which rows go together.
mr_stack(x, ..., na.rm = FALSE)
ms_stack(x, ..., na.rm = FALSE)
x |
multiple response object |
... |
other multiple response objects |
na.rm |
drop |
A data frame with columns values
and id
, plus a column scores
if x
is a ms
object. When more than one object is supplied, the result is an outer join of the two indindividual results, so it contains a row for every combination of an observed value from each object.
vmr_stack
data(ethnicity)
ethnicity
mr_stack(ethnicity)
data(nzbirds)
nzbirds
ms_stack(nzbirds)
## not actually a sensible use
d <- mr_stack(ethnicity, nzbirds)
head(d)
with(d, table(ethnicity, nzbirds))
## equivalent, but more efficient
mtable(mr_na(ethnicity), mr_na(nzbirds))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.