I have made some pairwise calculations and stored them in a matrix. Now I would like to label each row and column using some group labels.
name <- c("one name", "two name", "three name", "four name")
group <- c("group a", "group a", "group b", "group b")
groups <- data.frame(names = name, groups = group)
z <- matrix(c(1,0,0.2,0,
0,1,0,1,
.02,0.4,1,0,
0,.5,0,1),
nrow=4,
dimnames=list(name,name))
z <- as.matrix(z)
rownames(z) <- groups$groups
colnames(z) <- groups$groups
When I view the matrix in Rstudio, I see it as:
Why is that? Will it have any effect on my future calculations? What about the spaces that are concatenated into dots and added numbers as suffixes, can I avoid that or change the suffix to specific letters or symbols?
EDIT: Now I as I moved on in my analysis, I've plotted some clusters using the library(factoextra)
. the fviz_cluster
does not allow duplicate row.names, so I guess I'm also looking for a hack that allows that.