I'm trying to do a hierarchical analysis using Hclust(), but I can't get the names of each case to appear in the dendrogram. Only their numerical identifier appears. The strange thing is that I do the same procedure with my data and with the USArrests database integrated in R. With USArrests it works very well, but not with my data frame, which is built by importing it from Excel.
This I do with my data (df2, a data frame):
d2<-hclust(dist(df2)) Warning message: In dist(df2) : NAs introduced by coercion
Then plot(d2, hang = -1) delivers the dendrogram, but not the label names, only the numerical identifier.
The warning I think is for the names of the observations, which are characters, but the USArrests base also has a character variable, and the dendrogram appears with the names of the labels. The only difference I see is that in my data, the names of the observations appear justified on the right, and in USArrests on the left:
> head(USArrests)
Murder Assault UrbanPop Rape
Alabama 13.2 236 58 21.2
Alaska 10.0 263 48 44.5
Arizona 8.1 294 80 31.0
Arkansas 8.8 190 50 19.5
California 9.0 276 91 40.6
Colorado 7.9 204 78 38.7
> head(df2)
Mort_inf Esp_Vida_M Esp_vida_H
1 Argentina 25.6 75 68
2 Barbados 20.3 78 73
3 Bolivia 75.0 64 59
4 Brazil 66.0 67 57
5 Chile 14.6 78 71
6 Colombia 28.0 75 69
I don't understand what's going on. Any help would be appreciated.
Luis
The result of dput() is:
> dput(head(df2))
structure(list(c("Argentina", "Barbados", "Bolivia", "Brazil",
"Chile", "Colombia"), Mort_inf = c(25.6, 20.3, 75, 66, 14.6,
28), Esp_Vida_M = c(75, 78, 64, 67, 78, 75), Esp_vida_H = c(68,
73, 59, 57, 71, 69)), row.names = c(NA, 6L), class = "data.frame")
Thanks...

dput? - Chris RuehlemannUSArreststhose names are not a variable, they are therownames. Can you post the output ofdput(head(df2))? - Rui Barradas