Thursday, March 22, 2018

Recent changes: trim dupes by raster, species from csv file, and improvements to ecospat tests

I've been making a bunch of small changes recently.  Some of it you won't see, but bits of it are there to make your life easier.  One nice little trick is that now you can go:

species.list = species.from.file("myfile.csv", species.col = "Species")

That will create a unique enmtools.species object for every unique value in the column named "Species".  If you have one species in the file, you just get back an enmtools.species object.  If you have multiple species in the file, you get a list of enmtools.species objects.  This will save a ton of time, particularly if you're building an entire clade for the aoc tests.



I've also added a "trim.dupes.by.raster" function.  Basically you feed that a set of points and a raster, and it trims your data set down so there's a max of one point per grid cell.  Nothing dramatic, but it's something people do a lot so it's worth automating.  It's easy to use too:

new.points = trim.dupes.by.raster(old.points, env)


Finally, I tweaked a bunch of stuff for the ecospat functions.  Most of it you won't notice, but it deals with some potential errors that could come up if you had mismatched NAs in your environment rasters.  The big changes are (1) ecospat was calculating p values wrong, so now that's being done in ENMTools, and (2) now the ENMTools ecospat functions will automatically do PCA if you pass them more than two rasters unless told otherwise.

No comments:

Post a Comment