1
標題說得很清楚。我的問題很簡單。假設我有向量x:如何獲得總和矩陣而不是距離
x <- c(13,10,9,5)
# this function gives only distances
dist(x)
1 2 3
2 3
3 4 1
4 8 5 4
Instead of distance I would like to have sums like this:
# sum matrix
1 2 3
2 23
3 22 19
4 18 15 14
怎麼辦呢?dist
函數中有一些參數嗎?
如果你想要得到的矩陣作爲例子,只需使用'print(sums,na.print =「」)',+1! –
偉大的點Jilber。 –