我有10,000个蛋白质作为列,每个都有一个表达值。
A B C D E F Value 0.1 3 4 5 6 10 I would like to calculate the matrix as A B C D E F A B C D E F
我怎么能在R中做到这一点?
eyh26e7m1#
您可以尝试dist如下
dist
> x <- c(A = 0.1, B = 3, C = 4, D = 5, E = 6, F = 10) > as.matrix(dist(x)) A B C D E F A 0.0 2.9 3.9 4.9 5.9 9.9 B 2.9 0.0 1.0 2.0 3.0 7.0 C 3.9 1.0 0.0 1.0 2.0 6.0 D 4.9 2.0 1.0 0.0 1.0 5.0 E 5.9 3.0 2.0 1.0 0.0 4.0 F 9.9 7.0 6.0 5.0 4.0 0.0
1条答案
按热度按时间eyh26e7m1#
您可以尝试
dist
如下