Open anemone19 opened 6 months ago
This is resolved by modifying the function fitSpOccu
by adding an argument explicitly for year_sel called year (for example) and then calling the function as:
# Fit model
if(config$package == "spOccupancy"){
fitSpOccu(site_data_year, visit_data_year, config, sp_code, spatial, sp_sites, year = year_sel)
} else if(config$package == "occuR"){
fitOccuR(site_data_year, visit_data_year, config, spatial, sp_sites, verbose = varargs$print_fitting)
}
Not sure why inputting year_sel as allowed (as an additional argument) by the function does not work.
Here is the setup and model fitting code:
For species which more than 22 pentads in 2023, i.e. spcode = 6, the following error is produced:
Although not where the error is triggered (as suggested by the traceback) - the object 'year_sel' is first created and subsequently removed in lines 38 to 42 of the
ppl_run_pipe_dst1
script:Following the traceback. In the fit step 'year_sel' is an argument for the function
ppl_fit_occu_model
function:Then the function 'fitSpOccu' does not pick up the
year_sel
argument: