if (FALSE) {
library(palmerpenguins)
data(penguins)
bill_data = na.omit(penguins[,3:4])
hv = hypervolume(bill_data)
# Example 1: Get 50 resampled hypervolumes
# Use detectCores to see how many cores are availible in current environment
# Set cores = 1 to run sequentially (default)
path = hypervolume_resample("example_bootstrap",
hv,
method = "bootstrap",
n = 50,
cores = 12)
hvs = to_hv_list(path)
# Example 2: Get resample with applied weights
# Get maximum bill length
max_bill = max(bill_data$bill_length_mm)
# Make data with larger bill length slightly more likley to be resampled
weighted_path = hypervolume_resample("weighted test",
hv,
method = "weighted bootstrap",
n = 50,
cores = 12,
mu = max_bill,
sigma = 90,
cols_to_weigh = "bill_length_mm")
hvs_weighted = to_hv_list(weighted_path)
}
Run the code above in your browser using DataLab