data(HairEyeColor)
tableMargin(HairEyeColor, "Hair") ## same as:
tableMargin(HairEyeColor, 1)
tableMargin(HairEyeColor, c("Hair", "Eye")) ## same as:
tableMargin(HairEyeColor, c(1, 2))
tableSlice(HairEyeColor, "Sex", "Male") ## same as:
tableSlice(HairEyeColor, 3, 1)
tableSlice(HairEyeColor, "Sex", "Male", impose=1000) ## same as:
tableSlice(HairEyeColor, 3, 1, impose=1000)
t1 <- array(1:4, dim=c(2,2), dimnames=list(gender=c('male','female'),
answer=c('yes','no')))
t2 <- array(5:8, dim=c(2,2), dimnames=list(answer=c('yes','no'),
category=c(1,2)))
tableOp(t1, t2, "*")
tableOp(t1, t2, "/")
data(reinis)
t1 <- tableMargin(reinis, c(6, 5, 2, 1))
t2 <- tableMargin(reinis, c(6, 5, 3, 4))
tt1 <- tableOp(t1, t2)
t1 <- tableMargin(reinis, c(6, 5, 2, 4, 1))
t2 <- tableMargin(reinis, c(6, 5, 4))
tt1 <- tableOp2(t1, t2)
tableSetSliceValue(HairEyeColor, "Eye", "Brown")
tableSetSliceValue(HairEyeColor, "Eye", "Brown", complement=TRUE)
tableSetSliceValue(HairEyeColor, c("Eye","Hair"), c("Brown","Black"))
tableSetSliceValue(HairEyeColor, c("Eye","Hair"), c("Brown","Black"), complement=TRUE)
Run the code above in your browser using DataLab