Skip to content

Instantly share code, notes, and snippets.

@drammock
drammock / voach.R
Last active September 17, 2020 13:18
quick-and-dirty implementation to find the overlap area of the convex hulls of vowel measurements
library(phonR) # convexHullArea
library(sp) # SpatialPolygons, etc
library(rgeos) # gIntersection
data(indoVowels)
female_two <- indo[indo$subj == "F02",]
by_vowel <- split(female_two, female_two$vowel)
hull_indices <- sapply(by_vowel, function(df) with(df, chull(f1, f2)))
hulls <- sapply(names(by_vowel), function(v) by_vowel[[v]][hull_indices[[v]],],
simplify=FALSE)
matrices <- sapply(hulls, function(df) as.matrix(df[,c("f1", "f2")]))