if (FALSE) {
data(penguins,package='palmerpenguins')
penguins_no_na = as.data.frame(na.omit(penguins))
# split the dataset on species and sex
penguins_no_na_split = split(penguins_no_na,
paste(penguins_no_na$species, penguins_no_na$sex, sep = "_"))
# calculate the hypervolume for each element of the splitted dataset
hv_list = mapply(function(x, y)
hypervolume_gaussian(x[, c("bill_length_mm","bill_depth_mm","flipper_length_mm")],
samples.per.point=100, name = y),
x = penguins_no_na_split,
y = names(penguins_no_na_split))
# transform the list into an HypervolumeList
hv_list = hypervolume_join(hv_list)
# find optimal parameters
opt_par = find_optimal_occupancy_thin(hv_list,
classification = rep(c("female", "male"), 3),
n = 20)
head(opt_par)
unoptimized_hv_occ = hypervolume_n_occupancy(hv_list,
classification = rep(c("female", "male"), 3))
optimized_hv_occ = hypervolume_n_occupancy(hv_list,
classification = rep(c("female", "male"), 3),
quant.thin = opt_par[1, 2], seed = opt_par[1, 1])
}
Run the code above in your browser using DataLab