1 |
x |
|
depfun |
|
DH |
|
FRAC |
|
... |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (x, depfun = fdepth, DH = FALSE, FRAC = 0.5, ...)
{
if (is.data.frame(x))
x = as.matrix(x)
if (!is.matrix(x))
stop("x must be a matrix or a data frame")
temp <- depfun(x, plotit = FALSE, ...)
temp2 <- order(temp)
if (!DH) {
val <- matrix(x[temp2[length(temp)], ], ncol = ncol(x))
nmid <- round(length(temp)/2)
id2 <- (temp[temp2[nmid]] == temp)
val2 <- matrix(x[id2, ], ncol = ncol(x))
if (!is.matrix(val2))
val2 <- t(as.matrix(val2))
val <- rbind(val, val2)
}
if (DH) {
bot = round(length(temp) * FRAC)
val = matrix(x[temp2[bot:length(temp)], ], ncol = ncol(x))
}
val = elimna(val)
val
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.