0

I keep running into an error while trying to run the BIOMOD_FormatingData()-function.

I have checked through all arguments and removed any NA-values, the explanatory variables are the same for both the testing and training datasets (independent datasets), and I've generated pseudo-absence data for the evaluation dataset (included in eval.resp.var).

Has anyone run into this error before? and if so, what was the issue related to? This is my first time using Biomod2 for ensemble modelling and I've run out of ideas as to what could be causing this error!

Here is my script and the subsequent error:

library(biomod2)

geranium_data <- 
        BIOMOD_FormatingData(
                resp.var = SG.occ.train['Geranium.lucidum'],
                resp.xy = SG.occ.train[, c('Longitude', 'Latitude')],
                expl.var = SG.variables, 
                resp.name = "geranium_data",
                eval.resp.var = SG.test.data['Geranium.lucidum'], 
                eval.expl.var = SG.variables, 
                eval.resp.xy = SG.test.data[, c('Longitude', 'Latitude')], 
                PA.nb.rep = 10, 
                PA.nb.absences = 4650, 
                PA.strategy = 'random',
                na.rm = TRUE
        )
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= geranium_data Data Formating -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
        Response variable name was converted into geranium.data
> Pseudo Absences Selection checkings...
> random pseudo absences selection
> Pseudo absences are selected in explanatory variablesError in `names<-`(`*tmp*`, value = c("calibration", "validation")) : incorrect number of layer names
Mark
  • 7,785
  • 2
  • 14
  • 34
  • 1
    Hi, welcome to StackOverflow. It's generally requested that users provide a small dataset that reproduces the error/problem that they experience. With the information that you are providing right now, it's not really possible to understand what is going wrong. The names of your data suggest that you cannot share the data, so instead I'll ask: Can you give a clearer description of the data and the functions? You talk about "the rigth 4970 rows for the response variable"; which object is that? And which function would you use for further modeling? – slamballais May 15 '21 at 18:46
  • Also, does the problem simply not arise due to the missing value? You noted `na.rm = TRUE`, so it removes that one row, leaving you with 4,969 rows and apparently an object of 4,6970 that you are trying to compare together (right?). So can you not just remove that row from both objects? – slamballais May 15 '21 at 18:48
  • 1
    Thanks! that was the problem... i had a missing value in my explanatory variables data frame, so the ''na.rm = TRUE '' deleted the complete row. For the next post, i will give more information so the promblem can be understood clearly. – christian4vk May 17 '21 at 10:47

0 Answers0