Exploration of Multivariate Data

library(gclus)
library(car)
library(MASS)
library(cluster)
library(lattice)
library(TeachingDemos)

data(wine)

# chernoff faces
faces(aggregate(wine, list(wine$Class), FUN=mean)[,-c(1,2)], ncol=3, nrow=1)

# LDA on wine data
l <- lda(Class ~ . , data=wine)
plot(l, col=wine$Class)



## Some soils data from the car package
# LDA: all horizons
l <- lda(Contour ~ pH + N + Dens + P + Ca + Ca + Mg + K + Na, data=Soils)
plot(l, col=as.numeric(Soils$Contour))

# just the top horizon
l <- lda(Contour ~ pH + N + Dens + P + Ca + Ca + Mg + K + Na, data=Soils, subset=Depth=='0-10')
plot(l, col=as.numeric(Soils$Contour[Soils$Depth == '0-10']))