我正在尝试计算三维坐标系中两点之间的距离。我有两点:1)“释放”(x,y,z)和2)“夺回”(x,y,z)。我想为每个重新捕获的个体计算这两点之间的欧几里得距离。
我在R中导入的数据集如下:
| | Rel_x | Rel_y | Rel_z | Rec_x | Rec_y | Rec_z | Distance |
|--------------|---------|---------|--------|---------|---------|--------|----------|
| Individual_1 | 231.114 | 177.002 | 17.329 | 228.288 | 178.908 | 17.243 | ? |
| Individual_2 | 239.028 | 178.789 | 16.526 | 239.057 | 178.706 | 16.499 | ? |
| Individual_3 | 212.109 | 210.142 | 18.791 | 212.300 | 208.693 | 18.372 | ? |
我还想添加一列(距离)以报告“释放”和“重新捕获”两点之间的欧式距离。
我尝试使用dist()函数,但是不确定我的代码行是否正确,例如
dist (data_set),method = "euclidean",diag = FALSE,upper = FALSE,p = 2)
运行此行代码时,收到以下消息:
Warning message: In dist(data_set) : NAS introduced by coercion
您有什么建议吗?