fitzLab-AL / gdm

R package for Generalized Dissimilarity Modeling
GNU General Public License v3.0
33 stars 12 forks source link

How can I obtain the unique identifiers of the sites that are being compared by the Bray-Curtis index using formatsitepair() #25

Closed fsdias closed 7 months ago

fsdias commented 2 years ago

I would like two add two columns to an object created by formatsitepair() containing unique identifiers for the sites that are being compared by the Bray-Curtis index. Something like this:

site_id1, site_id2, distance, weights,
1,2,0.5,1
1,3,0.8,1

I run the example code

head(southwest)
sppData <- southwest[c(1,2,13,14)]
envTab <- southwest[c(2:ncol(southwest))]

sitePairTab <- formatsitepair(sppData, 2, XColumn="Long", YColumn="Lat", sppColumn="species",
                              siteColumn="site", predData=envTab)

head(sitePairTab )

 distance weights s1.xCoord s1.yCoord s2.xCoord s2.yCoord s1.awcA s1.phTotal s1.sandA  s1.shcA s1.solumDepth
132   0.4485981       1   115.057 -29.40472  115.5677 -29.46599 23.0101   480.3266 83.99326 477.5656      1129.933
132.1 0.7575758       1   115.057 -29.40472  116.0789 -29.52556 23.0101   480.3266 83.99326 477.5656      1129.933
132.2 0.8939394       1   115.057 -29.40472  116.5907 -29.58342 23.0101   480.3266 83.99326 477.5656      1129.933
132.3 0.9178082       1   115.057 -29.40472  117.1029 -29.63957 23.0101   480.3266 83.99326 477.5656      1129.933

and noticed that some row.names seem to be a combination of two numbers (e.g. 131.1) but others do not (e.g. 132). I also noticed these numbers do not to match the column "site" from "envTab".

I think I need help from someone who knows the inner workings of the function.

Thank you.