NCRN / NPSForVeg

NPS forest vegetation analysis in R
8 stars 5 forks source link

Improve SiteXSpec output when a "group" is not present #150

Open johnpauls opened 2 months ago

johnpauls commented 2 months ago

If you run SiteXSpec() on an object /group combination for which there is no data, you get the following error: Error in e2[[j]] : subscript out of bounds.

This should be altered to give a SiteXSpec matrix with all plots listed, no species, but a Total column with all zeroes, assuming Total=TRUE

johnpauls commented 2 months ago

This can be done by adding a check after line 106 to see if XPlants has any rows, and if not creating the desired outcome. If the species argument is not NA then columns can be created for each requested species.