This function computes Euclidean distances (km) between all combinations of receivers.

dist_btw_receivers(moorings, f = NULL, return = c("data.frame", "matrix"))

Arguments

moorings

A dataframe that defines each unique receiver deployment. This should contain the columns: `receiver_id', a unique identifier of each receiver; `receiver_long' or `receiver_easting', the longitude or easting of that receiver; and `receiver_lat' or `receiver_northing', the latitude or northing that receiver (see dat_moorings).

f

(optional) A function to process distances. For example, round distances to the nearest km with f = function(x) round(x, digits = 0) or simply round.

return

A character that defines the class of the returned object ("data.frame" or "matrix").

Value

The function returns a dataframe, with columns `r1', `r2' and `dist', or a matrix. Dataframe columns define the IDs of each combination of receivers and the associated distance between them, in km (or map units/1000). Note that the dataframe contains duplicate combinations of receivers (e.g., both r1 = 1 and r2 = 2 and r1 = 2 and r2 = 1). Alternatively, matrix rows and columns define receiver IDs and cell values give distances between each combination.

Details

Distances are calculated via pointDistance. If moorings contains `receiver_long' and `receiver_lat', pointDistance is implemented with lonlat = TRUE and distances are in km; otherwise lonlat = FALSE and distances are in map units over 1000 (i.e., km if map units are metres).

To calculate distances between specific receiver pairs, call pointDistance directly.

Author

Edward Lavender

Examples

#### Example (1): Implementation using lat/long coordinates
dat <- data.frame(
  receiver_id = dat_moorings$receiver_id,
  receiver_long = dat_moorings$receiver_long,
  receiver_lat = dat_moorings$receiver_lat
)
# Compute distances
dist_btw_receivers_km <- dist_btw_receivers(dat)
head(dist_btw_receivers_km)
#>   r1 r2      dist
#> 1  3  3  0.000000
#> 2  4  3 14.111344
#> 3  7  3 15.308019
#> 4  9  3  0.542825
#> 5 11  3 13.765477
#> 6 12  3 13.796536

#### Example (2): Implementation using planar coordinates
proj_wgs84 <- sp::CRS(SRS_string = "EPSG:4326")
proj_utm <- sp::CRS(SRS_string = "EPSG:32629")
xy <- sp::SpatialPoints(
  dat[, c("receiver_long", "receiver_lat")],
  proj_wgs84
)
xy <- sp::spTransform(xy, proj_utm)
xy <- sp::coordinates(xy)
dat <- data.frame(
  receiver_id = dat_moorings$receiver_id,
  receiver_easting = xy[, 1],
  receiver_northing = xy[, 2]
)
head(dist_btw_receivers(dat))
#>   r1 r2       dist
#> 1  3  3  0.0000000
#> 2  4  3 14.1131960
#> 3  7  3 15.3099894
#> 4  9  3  0.5428911
#> 5 11  3 13.7672055
#> 6 12  3 13.7983575

#### Example (3): Post-process distances via the f argument
dist_btw_receivers_km_round <- dist_btw_receivers(dat, f = round)
head(dist_btw_receivers_km_round)
#>   r1 r2 dist
#> 1  3  3    0
#> 2  4  3   14
#> 3  7  3   15
#> 4  9  3    1
#> 5 11  3   14
#> 6 12  3   14
# convert distances to m
dist_btw_receivers_m <- dist_btw_receivers(dat, f = function(x) x * 1000)
head(dist_btw_receivers_m)
#>   r1 r2       dist
#> 1  3  3     0.0000
#> 2  4  3 14113.1960
#> 3  7  3 15309.9894
#> 4  9  3   542.8911
#> 5 11  3 13767.2055
#> 6 12  3 13798.3575

#### Example (4) Return distances in a matrix
# Get distances
dist_btw_receivers(dat, return = "matrix")
#>             3          4         7          9        11         12         14
#> 3   0.0000000 14.1131960 15.309989  0.5428911 13.767205 13.7983575 12.6143165
#> 4  14.1131960  0.0000000  1.717948 13.9034731  2.215489  0.5158684  6.3031421
#> 7  15.3099894  1.7179478  0.000000 15.0580751  1.873918  2.2331738  5.8899781
#> 9   0.5428911 13.9034731 15.058075  0.0000000 13.481255 13.6037023 12.2017218
#> 11 13.7672055  2.2154890  1.873918 13.4812546  0.000000  2.5660837  4.1767712
#> 12 13.7983575  0.5158684  2.233174 13.6037023  2.566084  0.0000000  6.5371715
#> 14 12.6143165  6.3031421  5.889978 12.2017218  4.176771  6.5371715  0.0000000
#> 18  8.5441944  5.5722752  6.864123  8.3492873  5.554672  5.2557499  6.4001268
#> 20 11.5955654  7.7771471  7.562382 11.1432486  5.769735  7.9414306  1.7771052
#> 21  2.5467428 14.9105530 16.286249  3.0823472 14.924666 14.5312253 14.3819801
#> 23 11.9185942  7.2878539  7.014934 11.4790917  5.241995  7.4729726  1.1972754
#> 24  8.8755381  5.2973710  6.682056  8.7076910  5.500435  4.9442922  6.7183667
#> 26  2.9396514 14.6181256 16.028093  3.4556398 14.712752 14.2267075 14.3350204
#> 27  4.2871757 18.2836191 19.392210  4.3998996 17.762543 17.9934339 16.0658454
#> 29 15.1933708 10.1459903  9.298340 14.7071607  7.930895 10.4655416  4.2037585
#> 30  1.7195617 14.9534529 16.263879  2.2620589 14.826364 14.5973982 14.0221915
#> 31  3.3966631 14.4509808 15.893473  3.8958907 14.624906 14.0478467 14.4018070
#> 33  1.0282054 14.5084817 15.779969  1.5705932 14.304541 14.1667948 13.3872340
#> 35  9.5241889  4.5906708  5.852923  9.3134393  4.562023  4.2986239  5.8062375
#> 36  3.1433774 12.6684020 14.089550  3.4695071 12.804383 12.2751456 12.6410027
#> 37  2.2446477 16.1831886 17.440281  2.6739513 15.941962 15.8444418 14.8577172
#> 38  8.0904421  6.0738849  7.220449  7.8505363  5.744775  5.8104488  5.9785146
#> 39 11.2689782  5.0910638  5.222467 10.9058152  3.348552  5.1924047  2.0209296
#> 40 14.4707081  0.5574851  1.161366 14.2457623  1.927402  1.0733398  6.0946835
#> 41 12.8648683  6.2954818  5.814749 12.4525123  4.141283  6.5472923  0.2508392
#> 43  1.9040241 14.9806280 16.305051  2.4469151 14.882729 14.6195669 14.1305212
#> 44 13.1823564  1.0990698  2.786249 12.9950847  2.752657  0.6425807  6.4783178
#> 45  2.7069880 14.2293917 15.629983  3.2010389 14.304739 13.8417960 13.9169172
#> 46 12.2513617  7.5334929  7.177464 11.8053208  5.444070  7.7391213  1.2892746
#> 47 12.7982019  6.8895828  6.414011 12.3695947  4.742132  7.1334403  0.6090173
#> 48  0.7690849 14.2203232 15.478670  1.2975298 13.991965 13.8836922 13.0490347
#> 49  0.3065824 13.8679112 15.049961  0.3158502 13.495968 13.5586419 12.3124712
#> 50  7.2044442  6.9162041  8.123945  6.9873150  6.680230  6.6220023  6.7749247
#> 51  7.0484015  7.1834570  8.275751  6.7829129  6.723945  6.9309852  6.3811872
#> 52 12.5533132  7.2741439  6.852281 12.1142782  5.151727  7.4999671  0.9751503
#> 53  0.6743504 13.7016843 14.853815  0.2051285 13.276169 13.4031439 12.0053568
#> 54 11.9577584  7.7413732  7.447368 11.5062344  5.686416  7.9281017  1.5845003
#> 55  3.9842618 14.3738782 15.853354  4.4706648 14.642115 13.9571616 14.5946810
#> 56  3.2286348 14.4306359 15.862762  3.7290974 14.579379 14.0313218 14.3118579
#> 57  2.2978079 14.9207937 16.277994  2.8369614 14.893806 14.5480972 14.2752829
#>            18         20         21         23         24         26        27
#> 3   8.5441944 11.5955654  2.5467428 11.9185942  8.8755381  2.9396514  4.287176
#> 4   5.5722752  7.7771471 14.9105530  7.2878539  5.2973710 14.6181256 18.283619
#> 7   6.8641227  7.5623816 16.2862487  7.0149340  6.6820561 16.0280934 19.392210
#> 9   8.3492873 11.1432486  3.0823472 11.4790917  8.7076910  3.4556398  4.399900
#> 11  5.5546723  5.7697354 14.9246663  5.2419948  5.5004348 14.7127515 17.762543
#> 12  5.2557499  7.9414306 14.5312253  7.4729726  4.9442922 14.2267075 17.993434
#> 14  6.4001268  1.7771052 14.3819801  1.1972754  6.7183667 14.3350204 16.065845
#> 18  0.0000000  6.6343207  9.4252455  6.5176997  0.5715894  9.1828106 12.742700
#> 20  6.6343207  0.0000000 13.5652507  0.5800208  7.0648374 13.5861682 14.779500
#> 21  9.4252455 13.5652507  0.0000000 13.8229079  9.6226357  0.5941759  5.058317
#> 23  6.5176997  0.5800208 13.8229079  0.0000000  6.9154412 13.8210510 15.196923
#> 24  0.5715894  7.0648374  9.6226357  6.9154412  0.0000000  9.3493275 13.107267
#> 26  9.1828106 13.5861682  0.5941759 13.8210510  9.3493275  0.0000000  5.650887
#> 27 12.7427001 14.7794998  5.0583170 15.1969235 13.1072672  5.6508874  0.000000
#> 29 10.4295924  3.9336823 17.3115575  3.9244103 10.8069138 17.3760037 17.967781
#> 30  9.4072217 13.1086707  0.9505920 13.3982991  9.6570826  1.4959053  4.305071
#> 31  9.0767872 13.7144767  1.1293533 13.9289265  9.2118566  0.5389791  6.176484
#> 33  8.9433235 12.4433081  1.5324423 12.7422442  9.2226415  1.9765695  4.313521
#> 35  1.0121331  6.2883898 10.4373786  6.0899556  0.9912009 10.1933948 13.697791
#> 36  7.2594392 12.0265374  2.3160579 12.2135832  7.4079678  1.9521826  6.959990
#> 37 10.6149380 13.8171672  2.1234042 14.1506146 10.9006918  2.7168827  2.935873
#> 38  0.8820582  6.0122167  9.1876015  5.9553039  1.4536411  8.9966650 12.215710
#> 39  4.3990180  2.8356371 12.8242454  2.4707686  4.7001861 12.7227312 14.997975
#> 40  5.9498253  7.6404103 15.3330973  7.1299387  5.7105335 15.0530556 18.612736
#> 41  6.5918782  1.9512598 14.6286311  1.3736142  6.8979845 14.5795987 16.314584
#> 43  9.4441668 13.2353242  0.7548355 13.5189459  9.6832788  1.3133578  4.428784
#> 44  4.6460224  7.7807680 13.8926678  7.3419109  4.3174804 13.5859672 17.388521
#> 45  8.7798392 13.1740229  0.7670158 13.4062712  8.9539771  0.4189289  5.744716
#> 46  6.9261733  0.7015680 14.1840752  0.4117529  7.3200967 14.1902813 15.473132
#> 47  6.9041463  1.5085177 14.6408855  0.9735764  7.2446345 14.6162630 16.140995
#> 48  8.6514109 12.1032117  1.7856984 12.4022581  8.9408582  2.1714875  4.470249
#> 49  8.3030154 11.2894320  2.7882141 11.6134124  8.6448837  3.1475690  4.483335
#> 50  1.3942939  6.6379968  8.2476938  6.6430539  1.8618772  8.0550068 11.371998
#> 51  1.8845501  6.0960933  8.3040385  6.1463774  2.4219760  8.1611042 11.125992
#> 52  6.9699872  1.0898436 14.4489966  0.6352526  7.3396367 14.4420664 15.824035
#> 53  8.1492723 10.9557113  3.1695348 11.2882094  8.5103522  3.5153974  4.596943
#> 54  6.8626245  0.3638950 13.9200456  0.4552630  7.2771183 13.9371404 15.140777
#> 55  9.0875228 13.9749019  1.7400480 14.1671548  9.1845057  1.1576856  6.761111
#> 56  9.0356434 13.6084948  0.9855479 13.8281547  9.1807226  0.3913964  6.041726
#> 57  9.4140802 13.4304238  0.2768433 13.6973548  9.6269808  0.8471860  4.829450
#>           29         30         31         33         35        36        37
#> 3  15.193371  1.7195617  3.3966631  1.0282054  9.5241889  3.143377  2.244648
#> 4  10.145990 14.9534529 14.4509808 14.5084817  4.5906708 12.668402 16.183189
#> 7   9.298340 16.2638786 15.8934728 15.7799692  5.8529228 14.089550 17.440281
#> 9  14.707161  2.2620589  3.8958907  1.5705932  9.3134393  3.469507  2.673951
#> 11  7.930895 14.8263639 14.6249061 14.3045405  4.5620228 12.804383 15.941962
#> 12 10.465542 14.5973982 14.0478467 14.1667948  4.2986239 12.275146 15.844442
#> 14  4.203759 14.0221915 14.4018070 13.3872340  5.8062375 12.641003 14.857717
#> 18 10.429592  9.4072217  9.0767872  8.9433235  1.0121331  7.259439 10.614938
#> 20  3.933682 13.1086707 13.7144767 12.4433081  6.2883898 12.026537 13.817167
#> 21 17.311558  0.9505920  1.1293533  1.5324423 10.4373786  2.316058  2.123404
#> 23  3.924410 13.3982991 13.9289265 12.7422442  6.0899556 12.213583 14.150615
#> 24 10.806914  9.6570826  9.2118566  9.2226415  0.9912009  7.407968 10.900692
#> 26 17.376004  1.4959053  0.5389791  1.9765695 10.1933948  1.952183  2.716883
#> 27 17.967781  4.3050710  6.1764841  4.3135212 13.6977907  6.959990  2.935873
#> 29  0.000000 16.7848390 17.5376097 16.1003293  9.9417673 15.891320 17.363549
#> 30 16.784839  0.0000000  2.0300421  0.7032578 10.4146972  2.709543  1.421747
#> 31 17.537610  2.0300421  0.0000000  2.4718836 10.0827789  1.822556  3.246255
#> 33 16.100329  0.7032578  2.4718836  0.0000000  9.9440344  2.669906  1.680246
#> 35  9.941767 10.4146972 10.0827789  9.9440344  0.0000000  8.267202 11.612774
#> 36 15.891320  2.7095430  1.8225556  2.6699059  8.2672016  0.000000  4.130797
#> 37 17.363549  1.4217469  3.2462551  1.6802459 11.6127738  4.130797  0.000000
#> 38  9.879638  9.0840532  8.9417191  8.5744293  1.5365369  7.120138 10.226060
#> 39  6.180323 12.5538927 12.7424016 11.9554799  3.7858384 10.946645 13.505982
#> 40  9.824117 15.3523494 14.8978024 14.8930648  4.9516918 13.106402 16.563636
#> 41  4.092524 14.2711807 14.6441626 13.6368298  5.9751782 12.881003 15.108330
#> 43 16.925416  0.2011203  1.8505701  0.8789086 10.4533741  2.640074  1.514974
#> 44 10.511112 13.9650314 13.4057523 13.5394528  3.7069575 11.634237 15.217920
#> 45 16.969997  1.4710768  0.6969503  1.8134643  9.7910313  1.579640  2.815450
#> 46  3.512852 13.7466371 14.3047315 13.0864122  6.4871019 12.596928 14.478550
#> 47  3.616977 14.2470410 14.7027135 13.6001825  6.3506815 12.961258 15.036451
#> 48 15.762471  1.0293418  2.6362800  0.3401205  9.6491402  2.598061  1.963660
#> 49 14.887480  1.9970330  3.5828216  1.2965528  9.2775164  3.175786  2.545294
#> 50 10.552456  8.1560280  8.0021918  7.6573751  2.3263660  6.181224  9.316399
#> 51 10.026748  8.1298756  8.1553625  7.5881421  2.6630612  6.350732  9.218546
#> 52  3.467953 14.0297916 14.5445259 13.3749368  6.4762760 12.821446 14.785696
#> 53 14.531985  2.3824941  3.9383013  1.6824974  9.1119312  3.413680  2.862558
#> 54  3.634449 13.4677830 14.0615544 12.8034047  6.4737130 12.367432 14.180120
#> 55 17.828601  2.6517570  0.6220397  3.0832014 10.0841571  1.955337  3.840910
#> 56 17.423824  1.8699919  0.1687610  2.3034980 10.0433981  1.776227  3.108141
#> 57 17.157707  0.6737893  1.3861601  1.2751459 10.4258187  2.402373  1.894413
#>            38        39         40         41         43         44         45
#> 3   8.0904421 11.268978 14.4707081 12.8648683  1.9040241 13.1823564  2.7069880
#> 4   6.0738849  5.091064  0.5574851  6.2954818 14.9806280  1.0990698 14.2293917
#> 7   7.2204494  5.222467  1.1613657  5.8147493 16.3050509  2.7862494 15.6299827
#> 9   7.8505363 10.905815 14.2457623 12.4525123  2.4469151 12.9950847  3.2010389
#> 11  5.7447752  3.348552  1.9274016  4.1412832 14.8827293  2.7526573 14.3047395
#> 12  5.8104488  5.192405  1.0733398  6.5472923 14.6195669  0.6425807 13.8417960
#> 14  5.9785146  2.020930  6.0946835  0.2508392 14.1305212  6.4783178 13.9169172
#> 18  0.8820582  4.399018  5.9498253  6.5918782  9.4441668  4.6460224  8.7798392
#> 20  6.0122167  2.835637  7.6404103  1.9512598 13.2353242  7.7807680 13.1740229
#> 21  9.1876015 12.824245 15.3330973 14.6286311  0.7548355 13.8926678  0.7670158
#> 23  5.9553039  2.470769  7.1299387  1.3736142 13.5189459  7.3419109 13.4062712
#> 24  1.4536411  4.700186  5.7105335  6.8979845  9.6832788  4.3174804  8.9539771
#> 26  8.9966650 12.722731 15.0530556 14.5795987  1.3133578 13.5859672  0.4189289
#> 27 12.2157099 14.997975 18.6127356 16.3145838  4.4287844 17.3885212  5.7447163
#> 29  9.8796383  6.180323  9.8241166  4.0925235 16.9254162 10.5111115 16.9699971
#> 30  9.0840532 12.553893 15.3523494 14.2711807  0.2011203 13.9650314  1.4710768
#> 31  8.9417191 12.742402 14.8978024 14.6441626  1.8505701 13.4057523  0.6969503
#> 33  8.5744293 11.955480 14.8930648 13.6368298  0.8789086 13.5394528  1.8134643
#> 35  1.5365369  3.785838  4.9516918  5.9751782 10.4533741  3.7069575  9.7910313
#> 36  7.1201383 10.946645 13.1064025 12.8810027  2.6400742 11.6342373  1.5796396
#> 37 10.2260596 13.505982 16.5636361 15.1083296  1.5149736 15.2179201  2.8154499
#> 38  0.0000000  4.045125  6.3977465  6.1888126  9.1384154  5.2318757  8.5844977
#> 39  4.0451247  0.000000  5.0445940  2.1981565 12.6441190  4.9772072 12.3039767
#> 40  6.3977465  5.044594  0.0000000  6.0662961 15.3845979  1.6339604 14.6606891
#> 41  6.1888126  2.198157  6.0662961  0.0000000 14.3791296  6.5130004 14.1613955
#> 43  9.1384154 12.644119 15.3845979 14.3791296  0.0000000 13.9856650  1.3217280
#> 44  5.2318757  4.977207  1.6339604  6.5130004 13.9856650  0.0000000 13.2016915
#> 45  8.5844977 12.303977 14.6606891 14.1613955  1.3217280 13.2016915  0.0000000
#> 46  6.3669712  2.827465  7.3509968  1.4024796 13.8698358  7.6334018 13.7763107
#> 47  6.4384778  2.570601  6.6662619  0.6021222 14.3620266  7.0836007 14.1994540
#> 48  8.2676077 11.623625 14.5999794 13.2986976  1.1915451 13.2583384  1.9525515
#> 49  7.8329277 10.976505 14.2199538 12.5630720  2.1754080 12.9453429  2.8873841
#> 50  0.9416665  4.898327  7.2662898  6.9950501  8.2070347  6.0220304  7.6428421
#> 51  1.1269773  4.601098  7.4913654  6.6112916  8.1977942  6.3568247  7.7438610
#> 52  6.4530201  2.740853  7.0697301  1.0424705 14.1495871  7.4228912 14.0267357
#> 53  7.6472156 10.703238 14.0429119 12.2561204  2.5613772 12.7952271  3.2415055
#> 54  6.2674672  2.908752  7.5794275  1.7256446 13.5937224  7.7964032 13.5244679
#> 55  9.0126567 12.886215 14.8343750 14.8342197  2.4709765 13.3145928  1.2793841
#> 56  8.8849309 12.665066 14.8736246 14.5548406  1.6934175 13.3895816  0.5335230
#> 57  9.1513335 12.742597 15.3366129 14.5227027  0.4783430 13.9110553  0.9306502
#>            46         47         48         49         50        51         52
#> 3  12.2513617 12.7982019  0.7690849  0.3065824  7.2044442  7.048402 12.5533132
#> 4   7.5334929  6.8895828 14.2203232 13.8679112  6.9162041  7.183457  7.2741439
#> 7   7.1774636  6.4140106 15.4786701 15.0499610  8.1239447  8.275751  6.8522809
#> 9  11.8053208 12.3695947  1.2975298  0.3158502  6.9873150  6.782913 12.1142782
#> 11  5.4440703  4.7421318 13.9919654 13.4959679  6.6802300  6.723945  5.1517273
#> 12  7.7391213  7.1334403 13.8836922 13.5586419  6.6220023  6.930985  7.4999671
#> 14  1.2892746  0.6090173 13.0490347 12.3124712  6.7749247  6.381187  0.9751503
#> 18  6.9261733  6.9041463  8.6514109  8.3030154  1.3942939  1.884550  6.9699872
#> 20  0.7015680  1.5085177 12.1032117 11.2894320  6.6379968  6.096093  1.0898436
#> 21 14.1840752 14.6408855  1.7856984  2.7882141  8.2476938  8.304039 14.4489966
#> 23  0.4117529  0.9735764 12.4022581 11.6134124  6.6430539  6.146377  0.6352526
#> 24  7.3200967  7.2446345  8.9408582  8.6448837  1.8618772  2.421976  7.3396367
#> 26 14.1902813 14.6162630  2.1714875  3.1475690  8.0550068  8.161104 14.4420664
#> 27 15.4731320 16.1409945  4.4702486  4.4833348 11.3719983 11.125992 15.8240349
#> 29  3.5128522  3.6169771 15.7624708 14.8874798 10.5524557 10.026748  3.4679526
#> 30 13.7466371 14.2470410  1.0293418  1.9970330  8.1560280  8.129876 14.0297916
#> 31 14.3047315 14.7027135  2.6362800  3.5828216  8.0021918  8.155363 14.5445259
#> 33 13.0864122 13.6001825  0.3401205  1.2965528  7.6573751  7.588142 13.3749368
#> 35  6.4871019  6.3506815  9.6491402  9.2775164  2.3263660  2.663061  6.4762760
#> 36 12.5969278 12.9612584  2.5980607  3.1757857  6.1812239  6.350732 12.8214457
#> 37 14.4785497 15.0364506  1.9636603  2.5452941  9.3163986  9.218546 14.7856956
#> 38  6.3669712  6.4384778  8.2676077  7.8329277  0.9416665  1.126977  6.4530201
#> 39  2.8274648  2.5706015 11.6236255 10.9765045  4.8983268  4.601098  2.7408526
#> 40  7.3509968  6.6662619 14.5999794 14.2199538  7.2662898  7.491365  7.0697301
#> 41  1.4024796  0.6021222 13.2986976 12.5630720  6.9950501  6.611292  1.0424705
#> 43 13.8698358 14.3620266  1.1915451  2.1754080  8.2070347  8.197794 14.1495871
#> 44  7.6334018  7.0836007 13.2583384 12.9453429  6.0220304  6.356825  7.4228912
#> 45 13.7763107 14.1994540  1.9525515  2.8873841  7.6428421  7.743861 14.0267357
#> 46  0.0000000  0.8681827 12.7463099 11.9456474  7.0535285  6.553029  0.4085893
#> 47  0.8681827  0.0000000 13.2607473 12.4941961  7.2014549  6.768356  0.4701178
#> 48 12.7463099 13.2607473  0.0000000  1.0034010  7.3547834  7.272071 13.0349961
#> 49 11.9456474 12.4941961  1.0034010  0.0000000  6.9544696  6.781925 12.2481934
#> 50  7.0535285  7.2014549  7.3547834  6.9544696  0.0000000  0.719671  7.1760869
#> 51  6.5530289  6.7683561  7.2720714  6.7819253  0.7196710  0.000000  6.7053339
#> 52  0.4085893  0.4701178 13.0349961 12.2481934  7.1760869  6.705334  0.0000000
#> 53 11.6161106 12.1763021  1.3869487  0.3859969  6.7856734  6.578489 11.9233241
#> 54  0.3650836  1.2225547 12.4632943 11.6516761  6.9195508  6.393966  0.7722191
#> 55 14.5494294 14.9165833  3.2319269  4.1556545  8.0802194  8.285953 14.7759663
#> 56 14.2023303 14.6075989  2.4677657  3.4163422  7.9443758  8.083897 14.4452283
#> 57 14.0549788 14.5244867  1.5455108  2.5486308  8.2137135  8.246297 14.3252357
#>            53         54         55         56         57
#> 3   0.6743504 11.9577584  3.9842618  3.2286348  2.2978079
#> 4  13.7016843  7.7413732 14.3738782 14.4306359 14.9207937
#> 7  14.8538151  7.4473679 15.8533544 15.8627616 16.2779937
#> 9   0.2051285 11.5062344  4.4706648  3.7290974  2.8369614
#> 11 13.2761692  5.6864160 14.6421149 14.5793786 14.8938063
#> 12 13.4031439  7.9281017 13.9571616 14.0313218 14.5480972
#> 14 12.0053568  1.5845003 14.5946810 14.3118579 14.2752829
#> 18  8.1492723  6.8626245  9.0875228  9.0356434  9.4140802
#> 20 10.9557113  0.3638950 13.9749019 13.6084948 13.4304238
#> 21  3.1695348 13.9200456  1.7400480  0.9855479  0.2768433
#> 23 11.2882094  0.4552630 14.1671548 13.8281547 13.6973548
#> 24  8.5103522  7.2771183  9.1845057  9.1807226  9.6269808
#> 26  3.5153974 13.9371404  1.1576856  0.3913964  0.8471860
#> 27  4.5969426 15.1407769  6.7611112  6.0417265  4.8294497
#> 29 14.5319853  3.6344487 17.8286012 17.4238240 17.1577071
#> 30  2.3824941 13.4677830  2.6517570  1.8699919  0.6737893
#> 31  3.9383013 14.0615544  0.6220397  0.1687610  1.3861601
#> 33  1.6824974 12.8034047  3.0832014  2.3034980  1.2751459
#> 35  9.1119312  6.4737130 10.0841571 10.0433981 10.4258187
#> 36  3.4136798 12.3674321  1.9553372  1.7762271  2.4023729
#> 37  2.8625581 14.1801201  3.8409099  3.1081406  1.8944131
#> 38  7.6472156  6.2674672  9.0126567  8.8849309  9.1513335
#> 39 10.7032376  2.9087521 12.8862148 12.6650655 12.7425970
#> 40 14.0429119  7.5794275 14.8343750 14.8736246 15.3366129
#> 41 12.2561204  1.7256446 14.8342197 14.5548406 14.5227027
#> 43  2.5613772 13.5937224  2.4709765  1.6934175  0.4783430
#> 44 12.7952271  7.7964032 13.3145928 13.3895816 13.9110553
#> 45  3.2415055 13.5244679  1.2793841  0.5335230  0.9306502
#> 46 11.6161106  0.3650836 14.5494294 14.2023303 14.0549788
#> 47 12.1763021  1.2225547 14.9165833 14.6075989 14.5244867
#> 48  1.3869487 12.4632943  3.2319269  2.4677657  1.5455108
#> 49  0.3859969 11.6516761  4.1556545  3.4163422  2.5486308
#> 50  6.7856734  6.9195508  8.0802194  7.9443758  8.2137135
#> 51  6.5784892  6.3939664  8.2859533  8.0838967  8.2462966
#> 52 11.9233241  0.7722191 14.7759663 14.4452283 14.3252357
#> 53  0.0000000 11.3184975  4.5009575  3.7730800  2.9324444
#> 54 11.3184975  0.0000000 14.3172818 13.9565980 13.7865952
#> 55  4.5009575 14.3172818  0.0000000  0.7858942  2.0030226
#> 56  3.7730800 13.9565980  0.7858942  0.0000000  1.2345829
#> 57  2.9324444 13.7865952  2.0030226  1.2345829  0.0000000
# Compare sample to dataframe
dist_btw_receivers(dat)[1:5, ]
#>   r1 r2       dist
#> 1  3  3  0.0000000
#> 2  4  3 14.1131960
#> 3  7  3 15.3099894
#> 4  9  3  0.5428911
#> 5 11  3 13.7672055
dist_btw_receivers(dat, return = "matrix")[1:5, 1:5]
#>             3         4         7          9        11
#> 3   0.0000000 14.113196 15.309989  0.5428911 13.767205
#> 4  14.1131960  0.000000  1.717948 13.9034731  2.215489
#> 7  15.3099894  1.717948  0.000000 15.0580751  1.873918
#> 9   0.5428911 13.903473 15.058075  0.0000000 13.481255
#> 11 13.7672055  2.215489  1.873918 13.4812546  0.000000