MomX / Momocs

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

Extract convex hulls points of each type #239

Open JohnSal1 opened 1 month ago

JohnSal1 commented 1 month ago

Hi,

How can I extract the convex hulls points (or all points) of each type (e.g., LM1, LM2, UM1, UM2) and store them in a dataframe?

Script: library(Momocs)

molars.f <- efourier( molars) molars.p <- PCA( molars.f) molars.l <- LDA( molars.p,~type)
plot_LDA( molars.l, chull = T, labelgroups = T,points = TRUE)

vbonhomme commented 1 month ago

hi, sth like this should bring you on the way !

as_tibble(molars.l$x) %>% select(PC1:PC2) %>% mutate(group=molars.l$fac$type) %>% group_split(group) %>% map(~.x[chull(.x[, 1:2]), ])

Le lun. 28 oct. 2024 à 14:40, JohnSal1 @.***> a écrit :

Hi,

How can I extract the convex hulls points (or all points) of each type (e.g., LM1, LM2, UM1, UM2) and store them in a dataframe?

Script: library(Momocs)

molars.f <- efourier( molars) molars.p <- PCA( molars.f) molars.l <- LDA( molars.p,~type) plot_LDA( molars.l, chull = T, labelgroups = T,points = TRUE)

— Reply to this email directly, view it on GitHub https://github.com/MomX/Momocs/issues/239, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABECQFWW33YPAAVSHZ7TRDDZ5YWCDAVCNFSM6AAAAABQXOJES6VHI2DSMVQWIX3LMV43ASLTON2WKOZSGYYTQNBVHEYDGOA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

-- vincentbonhomme.fr http://www.vincentbonhomme.fr cevennette.fr https://www.cevennette.fr 🌱