# NOT RUN {
## Generate two binary matrices
z <- matrix(rbinom(250*500, 1, 0.3), 250, 500)
z0 <- matrix(rbinom(250*500, 1, 0.3), 250, 500)
## Make the first and second cols of z identical
## so the set 1, 2 has prevalence roughly 0.3 compared
## to roughly 0.09 for any other pair of columns
z[, 1] <- z[, 2]
## Similarly for z0
z0[, 3] <- z0[, 4]
## Market basket analysis
out1 <- RIT(z)
out1[1:5, ]
## Finding interactions
out2 <- RIT(z, z0)
out2$Class1[1:5, ]
out2$Class0[1:5, ]
## Can also perform the above using sparse matrices
if (require(Matrix)) {
S <- Matrix(z, sparse=TRUE)
S0 <- Matrix(z0, sparse=TRUE)
out3 <- RIT(S, S0)
}
# }
Run the code above in your browser using DataLab