Wallace - Error in [[: attempt to select less than one element in get1index

923 views
Skip to first unread message

Areeb Hussain

unread,
Sep 29, 2020, 4:40:12 PM9/29/20
to Wallace Ecological Modeling App
Hi everyone,

I am a rookie in species distribution modelling, just experiencing the wonders of the wallace package. Really appreciate the developers for the work done in developing this brilliant package.

I was facing some errors and would very much appreciate some help in troubleshooting. I am running a model with about 150 occurrences and using bioclimatic variables from wallace (2.5 arcmin). Initially I was able to run the model and get complete results. However, since the past week I am facing an error even though I follow the exact same steps as before and use the exact same files. The following error is displayed in R :-

"Doing user-defined evaluation groups...
  ENMeval completed in 5 minutes 48.5 seconds.
  Warning: Error in [[: attempt to select less than one element in get1index
         97: renderUI [C:\Users\XXXXX\Documents\R\win-library\4.0\wallace\shiny/server.R#636
         96: func
         83: origRenderFunc
         82: output$envSelUI
           2: shiny: :runApp
           1: run_wallace    "

On Wallace, the model appears to run successfully and the AIC tables appear. However, the distribution maps are not generated and the Maxent evaluation plot also appears somewhat wrong. I can plot the different response curves, but every time I choose a variable to plot, the graph appears and the following warning is displayed in R:

"Warning in '[<-.data.frame'('*tmp*',  , v, value = list(93.701388888888889       :
        provided 100 variables to replace 1 variable  

On wallace the following is displayed: 
"
> User-specified CSV file Albopictus - Final.csv with total of 266 records with coordinates was uploaded.
> Total records thinned to [ 149 ] localities.
> Environmental predictors: WorldClim bioclimatic variables bio1-19 at 2.5 arcmin resolution.
! WARNING : Removed records without environmental values with occIDs: 177, 178, 179, 181, 285 .
> Study extent: minimum convex polygon. Study extent buffered by 0.5 degrees.
> Environmental data masked.
> Random background points sampled (n = 10000 ).
> Occurrences partitioned by jackknife method.
> Maxent ran successfully using maxnet and output evaluation results for 2 clamped models.  
"
I have the latest R and wallace installed (1.0.6.2) and I re-ran the model with both maxnet and maxent.jar functions (after placing the maxent.jar in dismo folder). I still get the same error. I have also tried uninstalling wallace and R and reinstalling R and all the packages again. Still didn't work. I would very much appreciate any help regarding this error and thank you all in advance. 

Gonzalo Pinilla-Buitrago

unread,
Oct 8, 2020, 4:50:27 PM10/8/20
to Wallace Ecological Modeling App
Hi Areeb,

Sorry for taking so long to reply. I was trying to replicate your issue without success (I used 2.5 min and jackknife partition) and I always got a map prediction. About the warning that you mentioned (Warning: Error in [[: attempt to select less than one element in get1index), I also got it but it is not affecting the prediction display. I would like to know what is your problem, but I require more information.

1. About the reported warning (Warning: Error in [[: attempt to select less than one element in get1index),  this warning appears in your RStudio console before or after press the ´Plot´ button on the Map prediction module?
2. You are using a jackknife partition with several points. Technically, this is not an issue for getting the map prediction, but I just want to be sure that this is not the reason for the problem. Please, select a partition method that not create too many folds (i.e. block) and let me know if you can get a map prediction. If yes, the problem is related to the number of partitions.
3. Also, I would like to know which version of ENMeval is installed on your machine. ENMeval package is a core dependency on Wallace. It was recently updated on CRAN to version 0.3.1 on Sep 12. So, potentially this new version is affecting Wallace. I am not 100% sure if this update is affecting Wallace (I already tested by myself and I didn´t get any problem). But I am curious that you were following the same steps and the map prediction module was not working for you. Maybe, you started to get this error after updating it to v0.3.1. Did you recently update the R packages on your machine?

I hope that this information will help us to figure out the issue.

Thanks for reporting this issue and thanks for using Wallace!

Best,
Gonzalo

Gonzalo Pinilla-Buitrago

unread,
Oct 8, 2020, 5:02:36 PM10/8/20
to Wallace Ecological Modeling App
Hi again,

Following the point about the new version of ENMeval (v0.3.1). I checked the code related to this new version and there is no hint of a change that could affect the map prediction. So, you can avoid this question.

Best,
Gonzalo

Areeb Hussain

unread,
Oct 10, 2020, 3:21:08 PM10/10/20
to Wallace Ecological Modeling App
Hi Gonzalo,

Many thanks for your response. 

As you suggested, I tried running the model with different partition methods (blocks). I still get the same error and map prediction does not appear as before. I have taken screenshots of the results to better understand the error. 

The error appears only after pressing the Plot button. As soon as the analysis is completed the following window is displayed in the Model tab with the evaluation table. The error also appears in R soon after analysis starts. 
evaluation statistics.JPG

When I click on the Map tab within the Model results the following map appears with the partitioned data. 

map prediction.JPG

In the visualization tab, I can view the evaluation plots and the variable response curves as well. However, the map appears blank as in the screenshot below. 
visualize plot map.JPG

Also, whenever I select any variable, evaluation table or map to view, the following error is displayed in RStudio multiple times with different occurrence points.
Warning in '[<-.data.frame'('*tmp*', , v, value - list(93.70138889, :
      provided 100 variables to replace 1 variable

In addition to the above, the following error is displayed when visualizing the map.

Warning in showSRID(uprojargs, format = "PROJ", multiline = "NO") :
     Discarded ellps WGS 84 in CRS definition: +proj=merc +a=6378137 +b=637817 +lat_0=0 +lon_0=0 +x_0=0 +y_0=0 +k=1 +units=m +nadgrids=@null +wktext +no_defs
Warning in showSRID(uprojargs, format = "PROJ", multiline = "NO") :
     Discarded datum WGS_1984 in CRS definition

rstudio error.JPG

The problem is particularly confounding, because I have run the same model with the same data previously on the same computer and it worked like a charm with full predictions and tables. It makes me wonder if I am doing something wrong somewhere, which might be creating this error. Once again thanks for your help and support. 

Regards,
Areeb

Gonzalo Pinilla-Buitrago

unread,
Oct 13, 2020, 2:12:30 PM10/13/20
to Wallace Ecological Modeling App
Hi Areeb,

Thanks for sharing detailed information about your problem. My first guess is that there is something peculiar in your data that is creating an unidentified bug on Wallace. But I would like to know something first. Is this issue also happening when you don´t use your own data?

If the answer is yes, I think that there is a problem with some dependency on Wallace. If no, we can confirm that it is something that is no working between your data and Wallace. If that is the case, I would like to replicate your problem using your own data (occurrences and/or rasters).  If you agree,  you can send these files to wallac...@gmail.com

Best,
Gonzalo

Areeb Hussain

unread,
Oct 15, 2020, 8:44:30 AM10/15/20
to Wallace Ecological Modeling App
Hello again Gonzalo, 

I tried running the model with a different dataset, and for good measure I also ran the model using data from gbif. Unfortunately I am still getting the same error.
In order to understand the error, I tried running the model on another computer and it worked well without any errors. I think I will continue modelling on the other computer, and hopefully we can figure out the issue in the meantime.

However, I am facing a new issue at the moment and would very much appreciate your help once again. I would like to model the distribution of a vector species in India only. When defining the background data, the bounding box, minimum convex and point buffers options do not include the whole country, due to which the model results appear for only some parts of the country. I have tried using a shapefile to define background points, but I get the following error when running the model with user-defined shapefile - 

Warning: Error in dismo::evaluate: cannot evaluate a model without absence and presence data that are not NA
  95: stop
  94: dismo::evaluate
  93: modelTune.maxnet
  92: tuning
  91: ENMeval::ENMevaluate
  90: <reactive> [modules/mod_c6_maxent.R#94]
  74: mod.maxent
  73: observeEventHandler [C:\Users\COE\Documents\R\win-library\4.0\wallace\shiny/server.R#519]
   2: shiny::runApp
   1: run_wallace

Does this mean that user defined shapefile can only be used when there is absence data present? If so, if I extend the buffer of the bounding box so that it covers the whole country (and a lot of parts of other countries), will the results be reliable?
Thanks again for your help. I am extremely grateful and indebted.

Regards.

Gonzalo Pinilla-Buitrago

unread,
Oct 15, 2020, 9:24:28 AM10/15/20
to Wallace Ecological Modeling App
Hi Areeb,

It is good to know that you run the model on another machine. Recently, people are reporting issues with several packages that are dependencies of Wallace dependencies. So, it is hard for us to figure out what the problem is. I am not sure if I already suggested it, but try to update all the packages on the machine that gives you problems.

About the new issue:
It looks like some of your occurrences and/or background points have NA values. So, are there points that are outside of your shapefile? If yes, please remove all the outsider points before process the environmental data. Unfortunately, there is no easy way to do it on Wallace, but you can use the 'Select Occurrences on Map' of the 'Process Occs' component.

At the moment, Wallace is not offering any algorithm that uses absence data. The user shapefile is used for defining the background data required on Maxent (presence-background algorithm). Finally, I don't see any problem using a background extent that it is not an administrative boundary. Keep in mind that country boundaries are not a limitation for species, so I prefer the extent defined by occurrences (e.g., bounding box). This approximation will also ensure that you are including more occurrences, so it is expected that you will have a better model. Then, if you are interested just in India, you can clip your map prediction to any region of your interest. Another option that you have is projecting your model to India.

Let me know if my suggestions work for you.

Best,
Gonzalo

Areeb Hussain

unread,
Oct 16, 2020, 9:49:40 AM10/16/20
to Wallace Ecological Modeling App
Hi Gonzalo,

The earlier problem seems to have been resolved (almost). I found that while maps are not displayed properly on the wallace window, I can download the individual maps and they display correctly on ArcGIS. The warnings still appear as before but I have the complete results. 

So it seems that the problem is only in displaying the map on the Wallace UI and not in any package or dependencies, thankfully. Since this is only a minor inconvenience, I don't think there should be any trouble. 
Regarding the new problem, I ran the model as suggested (by expanding the bounding box to include all the country) and the results seem to be reasonable and not facing any problems there.

Thank you so much for your help and support. I think we can consider this issue resolved. 
Kudos to the developers for the brilliant package, making science easy for all.

Regards
Areeb

Gonzalo Pinilla-Buitrago

unread,
Oct 16, 2020, 11:02:23 AM10/16/20
to Wallace Ecological Modeling App
Hi Areeb,

I am glad that you find a workaround for the first problem. I will keep an eye open about the issue of visualization. Hopefully, we find a solution soon.

Thanks for your comments. I am glad that Wallace is useful to you. User feedback is vital for us, so if you have any suggestion or enhancement for Wallace, you can also add a new Github issue.

Best,
Gonzalo
Reply all
Reply to author
Forward
0 new messages