mr_union {rimu}R Documentation

Set operations on multiple-response objects

Description

These functions take union, intersection, and difference of two multiple-response objects. An observation has a level in the union if it has that level in either input. It has the level in the intersection if it has the level in both inputs. It has the level in the difference if it has the level in x and not in y

Usage

mr_union(x, y,...)
mr_intersect(x, y,...)
mr_diff(x, y,...)

Arguments

x, y

Objects of class mr

...

not used

Value

Object of class mr

Examples


data(usethnicity)
race<-as.mr(usethnicity$Q5,"")
race<-mr_drop(race,c(" ","F","G","H"))
race <- mr_recode(race, AmIndian="A",Asian="B", Black="C", Pacific="D", White="E")
mtable(race)

hispanic<-as.mr(usethnicity$Q4==1, "Hispanic")
ethnicity<-mr_union(race, hispanic)
mtable(ethnicity)
ethnicity[101:120]



[Package rimu version 0.6 Index]