Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in niche function #26

Open
Wycology opened this issue May 22, 2024 · 1 comment
Open

Bug in niche function #26

Wycology opened this issue May 22, 2024 · 1 comment

Comments

@Wycology
Copy link

The niche function does not plot x and y values properly. They appear to overlap near the 0,0 coordinate.
Capture

library(sdm)

species <- vect(system.file("external/species.shp", package = "sdm"))

preds <- rast(list.files(path = system.file("external", package = "sdm"),
pattern = 'asc$', full.names = TRUE))

names(preds)

d <- sdmData(formula = Occurrence~., train = species, predictors = preds)

m <- sdm(Occurrence~., data = d, methods = c('rf', 'glm', 'brt'))

p1 <- ensemble(m, newdata = preds, setting = list(method = 'weighted', stat = 'AUC'))

niche(x = preds, h = p1, c('precipitation', 'temperature'))

@Wycology
Copy link
Author

Seems the implementation of terra functions and objects was the issue. If I wrap the x and h arguments to raster::stack and raster, the niche plot works fine as shown.

niche(x = raster::stack(preds),
h = raster(p1),
c('precipitation','temperature'))

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant