library(predictmeans)
block <- rep(1:3, each=12)
group <- rep(rep(1:3, each=4), 3)
data <- data.frame(block, group)
cbind(data, permindex(data, block="block", group="group", nsim=5))
# Permute group as a whole within each block first,
# then permute obs within each group.
cbind(data, permindex(data, block="block", nsim=5))
# Permute obs within each block only.
cbind(data, permindex(data, group="group", nsim=5))
# Permute groups as a whole block first,
# then permute obs within each group.
cbind(data, permindex(data, nsim=5)) # Free permutation.
Run the code above in your browser using DataLab