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)
Run the code above in your browser using DataLab