1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
Unlink('R.data')
donnees=read.csv2(choose.files(),header=T)
str(donnees)
donnees <- lapply(donnees, FUN = as.numeric)
donnees <- as.data.frame(donnees)
attach(donnees)
names(donnees)
dc <- dist(donnees, method ="euclidean", diag=FALSE, upper=FALSE)
library(cluster)
hier <- hclust(dc,"ward")
plot(hier)
plot(rev(hier$height), type="h",ylab="hauteurs", xlim=c(1,50), ylim=c(1,500000))
cah7<-cutree(hier,7)
cah7
donnees.cah <- cbind.data.frame(donnees, as.factor(cah7))
names(donnees.cah)
colnames(donnees.cah)[23] <- "CAH7"
names(donnees.cah)
library(FactoMineR)
catdes(donnees.cah,num.var=23) |