dmedian <-
function(x,depfun=pdepth,...){
#
# Compute the median based on the deepest point for the multivariate
# data in x
#
# For continuous variables, this function returns a unique median
#
# Projection distances are used by default.
# Another option is depfun=zdepth
#
if(is.null(dim(x)) || dim(x)==1)stop('x should be a matrix with two or more columns')
val=depfun(x,...)
id=which(val==max(val))
list(center=x[id,])
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.