R bloggers

Clusters of (French) Regions

FavoriteLoadingAdd to favorites

For the data scienec course of tomorrow, I just wanted to post some functions to illustrate cluster analysis. Consider the dataset of the French 2012 elections > elections2012=read.table( “http://freakonometrics.free.fr/elections_2012_T1.csv”,sep=”;”,dec=”,”,header=TRUE) > voix=which(substr(names( + elections2012),1,11)==”X..Voix.Exp”) > elections2012=elections2012[1:96,] > X=as.matrix(elections2012[,voix]) > colnames(X)=c(“JOLY”,”LE PEN”,”SARKOZY”,”MÉLENCHON”,”POUTOU”,”ARTHAUD”,”CHEMINADE”,”BAYROU”,”DUPONT-AIGNAN”,”HOLLANDE”) > rownames(X)=elections2012[,1] The hierarchical cluster analysis is obtained using > cah=hclust(dist(X)) > plot(cah,cex=.6) To get five groups, we have to…
Original Post: Clusters of (French) Regions

Leave a Reply

Your email address will not be published. Required fields are marked *