fitzLab-AL / gdm

R package for Generalized Dissimilarity Modeling

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issues with gdm.varImp()

jsocolar opened this issue · comments

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

Code updated per suggestion.