MomX / Momocs

:dove: Morphometrics using R
http://momx.github.io/Momocs/
51 stars 19 forks source link

Hierarchical clustering (CLUST) on Mean shapes (mshapes) #159

Closed raz1 closed 8 years ago

raz1 commented 8 years ago

Hi,

Is it possible to run CLUST on mean shapes?

Thanks.

vbonhomme commented 8 years ago

Hi,

Sure.

library(Momocs)
bf <- bot %>% 
  mutate(more_groups=rep(letters[1:4], each=10)) %>% 
  efourier()

# small bug that needs to be fixed
bf$fac %<>% .refactor()

# bm has $shp and $Coe component
bm <- bf %>% mshapes("more_groups")

# Momocs builtin CLUST
bm$Coe  %>% PCA  %>% CLUST()

# manually, on the matrix of coefficients
bm$Coe$coe %>% dist %>% hclust %>% plot