Search code examples
rrastermodelingr-sf

Unable to compile datasets using {sdmData} - error


I am using the {sdm} package to do the species distribution modelling of invasive species. The {vifcor} was done succesfully and the variables(rasters) with high correlation were excluded. I am unable to compile my rasters(bioclim variables, elevation , ndvi) , occurance data into the {sdmData} object. Below is my code and error.

library(sdm)
d <- sdmData(formula=species~., train=lant, predictors=brt_all)

Error

d <- sdmData(formula=species~., train=lant, predictors=brt_all)
Error in (function (classes, fdef, mtable)  : 
unable to find an inherited method for function ‘sdmData’ for signature ‘"formula", "sf", "missing", "RasterStack"’

Solution

  • The sf objects are still not supported in {sdm} package. Using the following works

    lant <- as(lant, 'Spatial')

    To turn lant into SpatialPointsDataFrame.