dapply {disto} | R Documentation |
Apply function for data underlying disto object
dapply(x, margin = 1, fun, subset, nproc = 1)
x |
disto object |
margin |
(one among 1 or 2) dimension to apply function along |
fun |
Function to apply over the margin |
subset |
(integer vector) Row/Column numbers along the margin |
nproc |
Number of parallel processes (unix only) |
Simplified output of 'sapply' like function temp <- dist(iris[,1:4]) dio <- disto(objectname = "temp")
# function to pick indexes of 5 nearest neighbors # an efficient alternative with Rcpp is required udf <- function(x) dim(x) <- NULL order(x)[1:6] hi <- dapply(dio, 1, udf)[-1, ] dim(hi)