Simple Crosstabs Operator

Share:

Description

This operator takes two variables and computes a simple cross tab.

Usage

1
lhs %xt% rhs

Arguments

lhs

the left hand side of the operator, a vector

rhs

the right hand side of the operator, a vector

Examples

1
2
3
4
5
6
7
b = c(1,0,0,1,1,0,1,1,1,0)
x = c(1,2,3,2,3,3,1,0,0,0)
y = rnorm(10)
z = c("Yes", "No", "Yes", "No", "No", "Yes", "No", "No", "Yes", "No")
data = data.frame(b, x, y, z)

factor(data$x) %xt% factor(data$b)