fitzLab-AL / gdm

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

Issues with gdm.varImp() #2

Closed jsocolar closed 2 years ago

jsocolar commented 8 years ago

Hello, I've encountered two issues with the gdm.varImp() function. The first is easy to solve: For GDMs fit to just one environmental variable, with geo=T, gdm.varImp() fails to run, due to the line

varNames <- colnames(spTable[,c(7:6+nVars))])

Presumably this should be replaced with

varNames <- colnames(spTable)[c(7:6+nVars))]

Second: gdm.varImp() decides how many sites to expect based on the unique number of site-coordinates. This seems reasonable enough, except that some users (like me) will input two different site names with different environmental conditions at a single set of coordinates (due to a matched-pair design). This is easy enough to solve by adding a tiny offset to the coordinates of the sites in condition 2, but it would probably stump anybody not comfortable looking at the source code. It would be nice if gdm.varImp figured out how many sites to expect based on the site names, instead.

Cheers Jacob

fitzLab-AL commented 2 years ago

Code updated per suggestion.