Learn R Programming

gggda (version 0.1.0)

depth_median: Depth median

Description

Compute the depth median of a data set.

Usage

depth_median(x, notion = "zonoid", ...)

Value

A one-row matrix of depth median coordinates.

Arguments

x

Matrix of data whose depth median is to be calculated; see ddalpha::depth.().

notion

The name of the depth notion (shall also work with a user-defined depth function named "depth.<name>").

...

Additional parameters passed to the depth functions.

Details

This function is called internally by stat_bagplot() and can be passed to stat_center() but is also exported directly for data analysis.

Examples

Run this code
# sample median
iris %>% 
  subset(select = -Species) %>% 
  depth_median()
# groupwise medians
iris %>% 
  split(~ Species) %>% 
  lapply(subset, select = -Species) %>% 
  lapply(depth_median) %>% 
  simplify2array() %>% t() %>% as.data.frame()

Run the code above in your browser using DataLab