PhilipMostert / PointedSDMs

Wrapper function for 'inlabru' for modeling species distribution models from disparate datasets.
23 stars 2 forks source link

Error with datasetOut function #8

Closed harshadkarandikar closed 12 months ago

harshadkarandikar commented 12 months ago

Hello! I am trying to run some of the package vignettes (specifically, the Solitary tinamou one linked in browseVignettes()) to understand how the functions run before adapting it to my own data. I am getting an error for the datasetOut function for the code line:

eBird_out <- datasetOut(model = fieldsModel, dataset = 'eBird')

Error in x$terms %||% attr(x, "terms") %||% stop("no terms component nor attribute") : no terms component nor attribute

This is on a system running MacOS 13.3, RStudio version 2023.06.1+524, PointedSDMs v1.2.1, but is also occurring on Rstudio running on Windows.

Thank you!

PhilipMostert commented 12 months ago

Hi, there's been a lot of changes to the package due to the migration to sf so there are a bunch of things outdated. Does the issue still hold when you use the github version: devtools::install_github('PhilipMostert/PointedSDMs)? I'm hoping to send the new version to CRAN sometime next month.

harshadkarandikar commented 12 months ago

Thank you for your response! I tried using the github version, and now the 'SolitaryTinamou' data that has to be loaded in in the vignette does not have any of the covariate layers (covariates <- SolitaryTinamou$covariates generates a NULL object, and there are covariate objects in SolitaryTinamou). So the code in the vignette after that point isn't working. I went back to the CRAN version, and the covariate layers are present when the SolitaryTinamou data is loaded.

PhilipMostert commented 12 months ago

The vignette on the Github version has also changed, and the covariates are now stored in a different folder. You should be able to access them with: terra::rast(system.file('extdata/SolitaryTinamouCovariates.tif', package = "PointedSDMs")).