if (FALSE) {
data(penguins,package='palmerpenguins')
penguins_no_na = as.data.frame(na.omit(penguins))
penguins_no_na_split = split(penguins_no_na,
paste(penguins_no_na$species, penguins_no_na$sex, sep = "_"))
hv_list = lapply(penguins_no_na_split, function(x)
hypervolume_gaussian(x[, c("bill_length_mm","bill_depth_mm","flipper_length_mm")],
samples.per.point=100))
hv_list = hypervolume_join(hv_list)
hv_occupancy = hypervolume_n_occupancy(hv_list)
# unweighted centroids
get_centroid(hv_occupancy)
# weighted centroids
get_centroid_weighted(hv_occupancy)
}
Run the code above in your browser using DataLab