Why can you not use the 'labels' argument as described in ?hclust (the Help system should always be the first place to look for answers to such questions):
## i.e. plot(hclust(specimens,"ward.D2"),hang=-1, labels = x[,1], ylab="distance",main="Classification des spécimens") ... or is there something about your example that I misunderstand? Cheers, Bert On Mon, May 15, 2023 at 9:17 AM Nicolas Degallier <nicolas.degall...@free.fr> wrote: > Dear R-users, > I'm probably using R too sparsely to solve a very trivial difficulty, as I > didn't find any clear example in the tutorials on the net. > > My matrix is as follows (18 rows-individuals x 4 variables-columns: > > L/l L/L_ely L/e L/L_car > LT 1.21875 1.56 1.857142857 5.2 > PLT 1.290322581 1.568627451 1.904761905 5.333333333 > ND1 1.426470588 1.732142857 2.255813953 4.85 > ND2 1.301587302 1.673469388 1.952380952 3.037037037 > ND3 1.235294118 1.555555556 2.8 4.666666667 > JML 1.188405797 1.576923077 1.863636364 5.466666667 > US1 1.338709677 1.693877551 1.886363636 5.045180795 > US3 1.333333333 1.67032967 2.08566708 4.832587575 > US5 1.328358209 1.679245283 2.08566708 5.045180795 > US7 1.279411765 1.673076923 2.175 4.93725 > Ml1 1.2 1.659574468 2.228571429 4.875 > Ml2a 1.298507463 1.673076923 2.175 5.045180795 > Ml2b 1.303030303 1.68627451 1.755102041 5.058823529 > Ml3 1.234375 1.645833333 1.975 4.981388889 > cri 1.291338583 1.673469388 2.08566708 5.045180795 > nat 1.323529412 1.698113208 2.195121951 5.1075 > nat 1.307692308 1.603773585 2.361111111 4.473684211 > Sallé 1.266666667 1.648433128 1.9 7.6 > > I ran an ACP and a classification with the following script: > > library(ade4) > library(stats) > library(cluster) > > x<-read.table(file.choose (),sep="\t",header=T) # lecture des données: > spécimens en lignes, variable en colonnes séparées par des tabulations > > labels <- x[,1] # étiquettes des spécimens > > x <- x[,-1] # sélection des valeurs > > acp<- dudi.pca(x , scannf= F,scale=T,center=T,nf=4) # analyse en > composantes principales > > s.label(acp$li, xax = 1, yax = 2, labels) # affichage des étiquettes des > specimens > > s.corcircle(acp$co) # corrélation entre les variables et les axes > principaux > > mat<-dist(x) # distances entre spécimens deux à deux > > specimens<-mat > > plot(hclust(specimens,"ward.D2"),hang=-1,ylab="distance",main="Classification > des spécimens") > > The resulting dendrogram is nice but I would like to have on the resulting > plot the labels of each specimen in place of the number of the rows. > > I really would be very happy if someone has some time to complete/fix my > script or indicate an explicit tutorial. > > Cheers > Nicolas Degallier > > 120 rue de Charonne > F-75011 Paris > <nicolas.degall...@free.fr> > <omalo...@yahoo.fr> > > Publications : > > https://www.documentation.ird.fr/listes/parauteur/DEGALLIER/NICOLAS/tout/annee > > « Je regarde la carte des vins pour éviter les bouchons » (Raymond Devos) > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.