# NOT RUN {
data(rainman)
long <- data.frame(stack(rainman[,2:6]), figure=factor(rep(rainman$SAND,5)))
figind <- interaction(long$figure,long$ind)
# Use a linear random effect model from the
# lme4 package if available
if(require(lme4)) {
model <- lmer(values ~ (1|ind) + (1|figure) + (1|figind), data=long)
}
#
# Point swarms were generated by the following program
#
# }
# NOT RUN {
set.seed(2) # Original
npoints <- sample(4:30)*4
nplots <- 10
pdf(file="swarms.pdf", onefile=TRUE)
s1 <- sample(npoints[1:nplots])
print(s1)
for (i in 1:nplots) {
n <- s1[i]
set.seed(n)
x <- runif(n)
y <- runif(n)
plot(x,y, xlim=c(-.15, 1.15), ylim=c(-.15, 1.15), pch=20, axes=FALSE,
xlab="", ylab="")
}
s1 <- sample(npoints[1:nplots])
print(s1)
for (i in 1:nplots) {
n <- s1[i]
set.seed(n)
x <- runif(n)
y <- runif(n)
plot(y,x, xlim=c(-.15, 1.15), ylim=c(-.15, 1.15), pch=20, axes=FALSE,
xlab="", ylab="")
}
s1 <- sample(npoints[1:nplots])
print(s1)
for (i in 1:nplots) {
n <- s1[i]
set.seed(n)
x <- runif(n)
y <- runif(n)
plot(-x,y, xlim=c(-1.15, .15), ylim=c(-.15, 1.15), pch=20, axes=FALSE,
xlab="", ylab="")
}
dev.off()
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab