# NOT RUN {
# }
# NOT RUN {
## Loads the data
data(puechabon)
sahr <- puechabon$sahr
## prepares the data for the kselect analysis
x <- sahrlocs2kselect(sahr)
tab <- x$tab
## Example of analysis with two variables: the slope and the elevation.
## Have a look at the use and availability of the two variables
## for the 4 animals
tab <- tab[,((names(tab) == "Slope")|(names(tab) == "Elevation"))]
tab <- scale(tab)
tmp <- split.data.frame(tab, x$factor)
wg <- split(x$weight, x$factor)
opar <- par(mfrow = n2mfrow(nlevels(x$factor)))
for (i in names(tmp))
s.distri(scale(tmp[[i]]), wg[[i]])
par(opar)
## We call a new graphic window
x11()
## A K-select analysis
acp <- dudi.pca(tab, scannf = FALSE, nf = 2)
kn <- kselect(acp, x$factor, x$weight,
scannf = FALSE, nf = 2)
# use of the generic function scatter
scatter(kn)
# Displays the first factorial plane
kplot(kn)
kplot(kn, cellipse = 0, cpoint = 0)
kplot(kn, addval = FALSE, cstar = 0)
# this factorial plane can be compared with
# the other graph to see the rotation proposed by
# the analysis
graphics.off()
# Displays the first factorial axis
hist(kn)
# Displays the second factorial axis
hist(kn, xax = 2)
# Summary of the analysis
plot(kn)
# }
Run the code above in your browser using DataLab