I'm working with pairwise distances in the format of a hollow matrix of 45 rows and 45 columns in which the upper and lower triangles are mirrored. I need to range standardize my entire matrix so that all values lie between 0 and 1. I've tried it with decostand(mat, method="range")
but since the columns are not independent of each other, this does not return the correct values. The upper triangle is no longer mirroring the lower triangle. I presume this is some sort of issue with centering or scaling the data?
Here's a bit of sample code to work with:
x<-c(0,5,4,7,8,
5,0,8,2,1,
4,8,0,3,2,
7,2,3,0,4,
8,1,2,4,0)
mat<-matrix(x,nrow=5,ncol=5,byrow=TRUE)
mat2<-decostand(mat,method="range")
and an example of how I would like the matrix to look once standardized..
V1 V2 V3 V4 V5
1 0 0.6 0.5 0.9 1
2 0.6 0 1 0.3 0.1
3 0.5 1 0 0.4 0.3
4 0.9 0.3 0.4 0 0.5
5 1 0.1 0.3 0.5 0
Is there a way of doing it without converting my data to a vector to standardise it and then back to a matrix? considering that I have a few matrices with dimensions up to 90 x 90 I would rather do it in one step, since then there's less chance of my data being mixed up by columns, because the ID is quite important.
Thanks!