【发布时间】:2016-03-16 22:57:11
【问题描述】:
所以目的是通过取距离来比较每个ID和其他ID。
考虑以下数据框Df
ID AN AW
a white green
b black yellow
c purple gray
d white gray
为了比较,我需要一个如下所示的组合:
ID AN AW ID2 AN2 AW2
a white green b black yellow
a white green c purple gray
a white green d white gray
b black yellow c purple gray
b black yellow d white gray
c purple gray d white gray
基本上,我正在尝试实现所有组合,以获取属于每个 ID 的特征之间的距离。
这里我真的不知道现在如何开始。有什么见解吗?我可以使用 R 中的哪些工具?
【问题讨论】:
-
使用ID:
t(combn(unique(Df$ID), 2))