hypervolume_to_data_frame: Convert hypervolumes to 'data.frame'

View source: R/hypervolume_to_data_frame.R

hypervolume_to_data_frameR Documentation

Convert hypervolumes to data.frame

Description

Convert objects of class Hypervolume or HypervolumeList to a data.frame.

Usage

hypervolume_to_data_frame(hv, remove_zeroes = TRUE)

Arguments

hv

A Hypervolume or HypervolumeList.

remove_zeroes

Remove zeroes from ValuesAtRandomPoints. See Details for further information. It works for hypervolume_n_occupancy(), hypervolume_n_occupancy_test(), occupancy_to_union(), occupancy_to_intersection() and occupancy_to_unshared(), otherwise ignored.

Details

Zero values are generated during the occupancy routine when a random point is included in some groups of hypervolumes but not in others. A tipical usage of hypervolume_to_data_frame() with objects generated with the occupancy routine should remove zeroes.

Value

A data.frame.

Examples

## Not run: 
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", "flipper_length_mm")],
                       samples.per.point=100, name = y), 
  x = penguins_no_na_split, 
  y = names(penguins_no_na_split))

hv_list <- hypervolume_join(hv_list)

# get the data.frame
hypervolume_to_data_frame(hv_list)

## End(Not run)

hypervolume documentation built on Sept. 14, 2023, 5:08 p.m.