mr_flatten | R Documentation |
Convert a multiple-response object into a factor using a supplied ordering. Each observation is assigned its first level in the ordering. That is, an observation that has priorities[1]
as one of its levels is assigned that value. An observation that does not priorities[1]
as one of its levels, but does have priorities[2]
is assigned priorities[2]
.
mr_flatten(x, priorities, sort=FALSE)
x |
|
priorities |
Character vector of levels. |
sort |
if |
A factor
data(ethnicity) ethnicity ## NZ 'prioritised ethnicity' priority<-c("Maori", "Pacific", "Asian", "European/Other") eth <- mr_na(mr_recode(ethnicity, `European/Other`="European", `European/Other` = "MELAA"), FALSE) mr_flatten(eth, priority) mr_flatten(eth, priority, sort=TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.