Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
R 的新手。我有一个 R 中几个组件的坐标矩阵,如下所示:
x y z C1 0.3 0.2 -1.2 C2 -1.5 0.7 0 C3 0.2 -0.75 0.22 ...
我的问题是如何在 R 中构建每个组件对的距离矩阵,例如:
C1 C2 C3 ... C1 0 0.2 0.7 ... C2 0.2 0 1.2 ... C3 0.7 1.2 0 ... ...
你会做
as.matrix(dist(Matrix))
然后:
rownames(DistMatrix) <- colnames(DistMatrix) <- rownames(Matrix)