x = array(1:16, rep(2,4))
x = x/sum(x) # probability distribution on 4 binary variables x1, x2, x3, x4.
# distribution of x2, x3 given x1 = 1 and x4=2.
condition.table(x, c(2,3), c(1,4), c(1,2))
# x2, x3 given x1 = 1,2 and x4 = 2.
condition.table(x, c(2,3), c(1,4), list(1:2,2))
# complete conditional of x2, x3 given x1, x4
condition.table(x, c(2,3), c(1,4))
# condition.table2 leaves dimensions unchanged
tmp = condition.table2(x, c(2,3), c(1,4))
aperm(tmp, c(2,3,1,4))
Run the code above in your browser using DataLab