summary function bug

26 views
Skip to first unread message

Brendan Alting

unread,
Jul 9, 2025, 11:02:05 AMJul 9
to spOccupancy and spAbundance users
Good afternoon, 

I've been running some multi species n-mixture models in spAbundance using the function sfMsNMix(). 

Code ran all ok before (about a month ago?), but as of a few days ago the summary() output is displaying every single number and results from the snMsNMix object, rather than a simple summary of model results. I'm assuming this is a bug as the same code was running earlier. I've tried reinstalling the package, and updating R, but no luck. Getting the same error on other machines also. when you run "level = community" it presents only community results, but with summary(model, level = "species"), or just summary(model), it prints the entire output (millions of lines). 

Any advice would be much appreciated!
Thanks, 
Brendan

Jeffrey Doser

unread,
Jul 10, 2025, 4:59:13 AMJul 10
to spOccupancy and spAbundance users
Hi Brendan,

Thanks for the note. I am not able to reproduce the problem with a simulated example. Does the problem happen for you when you try to run the example on the sfMsNMix() help page (using summary(out) instead of summary(out, level = 'community'))? If not, then I'm guessing something is going on in your code that for some reason changed the class or behavior of the model object. Are you doing any manipulation of the model object after you run the model and before you use summary()? If you run "class(model)" then it should return "sfMsNMix". If you can send me some code to take a look that might help diagnose the issue.

Thanks,

Jeff

Jeffrey Doser

unread,
Jul 17, 2025, 7:45:08 AMJul 17
to spOccupancy and spAbundance users
Hi Brendan,

Thanks for sending the data along privately. The weird printing behavior with summary had to do with some extremely long species names that you had given to the species in the "y" component of the data list. The following code will show you the problem and then change the names to something more reasonable. Then running the model with that updated data then results in summary() printing nicely.

str(dimnames(final_data$y))

# Change to something simple
dimnames(final_data$y)[[1]] <- c('Species_1', 'Species_2', 'Species_3')

Let me know if you have any questions.

Jeff

Brendan Alting

unread,
Jul 19, 2025, 4:43:52 AMJul 19
to spOccupancy and spAbundance users
Oh ok that makes sense! Not sure why the names were being created like that, I must have changed something in the code. 

Thanks very much for your quick response, much appreciated.

Brendan

Reply all
Reply to author
Forward
0 new messages