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

Error message with (setup_sdmdata) step #77

Open
SDMENM opened this issue Jul 17, 2020 · 4 comments
Open

Error message with (setup_sdmdata) step #77

SDMENM opened this issue Jul 17, 2020 · 4 comments

Comments

@SDMENM
Copy link

SDMENM commented Jul 17, 2020

Hello Everyone,

When I run the first code in ModleR, it gives me an error message. I am posting here the R code and error message. Can someone please help me with this.

setup_sdmdata(species_name = "L_agrorensis", occurrences = occ, predictors = stack, lon = "longitude",
lat = "latitude", models_dir = "./models", real_absences = NULL,
buffer_type = NULL, dist_buf = NULL, env_filter = FALSE, env_distance = "centroid",
buffer_shape = NULL, min_env_dist = NULL, min_geog_dist = NULL, write_buffer = FALSE,
seed = NULL, clean_dupl = FALSE, clean_nas = FALSE, clean_uni = FALSE, geo_filt = FALSE,
geo_filt_dist = NULL, select_variables = FALSE, cutoff = 0.8, sample_proportion = 0.8,
png_sdmdata = TRUE, n_back = 1000, partition_type = C("bootstrap"), boot_n = 1,
boot_proportion = 0.7, cv_n = NULL, cv_partitions = NULL)
Error in (function (classes, fdef, mtable) :
unable to find an inherited method for function ‘res’ for signature ‘"standardGeneric"’

@AndreaSanchezTapia
Copy link
Member

Hello, @SDMENM
We would need more details into the reasons for this error, such as the class or structure of "occ" and "stack". For now, the function seems to be having trouble recognizing the resolution of your predictor variables stack (function raster::res()). Please make sure that it is a raster package RasterBrick or RasterStack object, and that you can execute res(stack) with no problems.
Please let us know if that works, and thanks for using modleR! :)

@SDMENM
Copy link
Author

SDMENM commented Jul 17, 2020

raster::res(stack)
Error in (function (classes, fdef, mtable) :
unable to find an inherited method for function ‘res’ for signature ‘"standardGeneric"’

@SDMENM
Copy link
Author

SDMENM commented Jul 17, 2020

Thank you Andrea, that worked. let me try the remaining codes.

@SDMENM
Copy link
Author

SDMENM commented Jul 17, 2020

Hello again,

I am having problem running random forest with ModleR, I think my raster stack have NA values which are not permitted in the default settings of rf, can you please take a look. thanks.

do_any(species_name = "L_agrorensis", predictors = stack, models_dir = "./models",
algorithm = c("rf"), project_model = FALSE,
proj_data_folder = "./data/proj", mask = NULL, write_rda = FALSE,
png_partitions = FALSE, write_bin_cut = FALSE,
dismo_threshold = "spec_sens", equalize = TRUE, sensitivity = 0.9,
proc_threshold = 0.5)
rf
L_agrorensis rf run number 1 part. nb. 1
fitting models
Error in randomForest.default(x, y, mtry = mtryStart, ntree = ntreeTry, :
NA not permitted in predictors
In addition: Warning message:
In randomForest.default(x, y, mtry = mtryStart, ntree = ntreeTry, :
The response has five or fewer unique values. Are you sure you want to do regression?

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

2 participants