Hey I have a data set in which the col1 is the index for point1, col2 is the index for point2, the last col is the distance. I want to do some quick analysis using R packages. so I try to use the method mentioned: Converting pairwise distances into a distance matrix in R
point1 point2 distance
6839 14606 0.129411764706
9693 7211 0.24347826087
7854 303 0.0360920970753
13628 13628 0.47619047619
6868 3754 0.0182291666667
460 293 0.122362869198
3188 13063 0.041095890411
22968 1992 0.412844036697
477 105 0.0642201834862
332 2808 0.00982800982801
5690 4749 0.75
7420 584 0.92125984252
20082 1280 0.160256410256
20477 144 0.0277777777778
25280 20 0.00256081946223
after I do the
as.dist(xtabs(df[, 3] ~ df[, 2] + df[, 1]))
it reports:
In as.dist.default(xtabs(df2[, 3] ~ df2[, 2] + df2[, 1])) : non-square matrix
what's the issue? how to fix it? Thanks!