Reporting an error in morphol.disparity() function

28 views
Skip to first unread message

Mihajlo Milic

unread,
Oct 6, 2024, 9:45:18 AM10/6/24
to geomorph-...@googlegroups.com
Hi everyone,
I analyzed shape variation in my data with morphol.disparity() function when suddenly something seemed wrong with the function. The function worked well while argument seed = n  was not provided. However, when I added the seed argument the function returned the following error. 
Error: block factor not the same length as the number of observations.
I am sending you the code where the error was observed. 

The code is based on the example from the function description. The geomorph version I am working on is 4.0.8. (latest to my knowledge). If my assumption that something is wrong with the function is caused by my ignorance and inexperience,  I apologize in advance.
Regards,
Mihajlo

data(plethodon)
Y.gpa <- gpagen(plethodon$land, print.progress = FALSE)    #GPA-alignment
gdf <- geomorph.data.frame(Y.gpa, species = plethodon$species,
                           site = plethodon$site)

# Morphological disparity for entire data set
morphol.disparity(coords ~ 1, groups = NULL, data = gdf,
                  print.progress = FALSE, seed = 2)  ## WORKS!

# Morphological disparity for entire data set, accounting for allometry
morphol.disparity(coords ~ Csize, groups= NULL, data = gdf,
                  print.progress = FALSE, seed = 2) ## WORKS!

# Morphological disparity without covariates, using overall mean
# without seed argument
morphol.disparity(coords ~ 1, groups= ~ species * site, data = gdf,
                  print.progress = FALSE) ## WORKS!
# with seed argument
morphol.disparity(coords ~ 1, groups= ~ species * site, data = gdf,
                  print.progress = FALSE, seed = 2) ## ERROR!

Mihajlo Milic

unread,
Oct 6, 2024, 9:47:45 AM10/6/24
to geomorph-...@googlegroups.com
I forgot to mention that error appears only when groups are provided in the function.

Mike Collyer

unread,
Oct 6, 2024, 11:35:41 AM10/6/24
to geomorph R package
Dear Mihajlo,

This error was caused by a missing argument in an internal function.  The internal function was updated at one point but we missed updating its use in morphol.disparity, which would only be an issue if seed was changed from its default.  So you were the first to discover it, years after it could have been discovered.

If you reinstall geomorph from Github, it should work now.

Best,
Mike

--
You received this message because you are subscribed to the Google Groups "geomorph R package" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geomorph-r-pack...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/geomorph-r-package/CAJy6d1Sco7GO7P3jSLDit9m4gMzNk%2BzHMBtHTJdT4%3DPXiSpDAg%40mail.gmail.com.

Reply all
Reply to author
Forward
0 new messages