dapply: Matrix like apply function for disto object

Description Usage Arguments Value

View source: R/disto_methods.R

Description

Apply function for data underlying disto object

Usage

1
dapply(x, margin = 1, fun, subset, nproc = 1)

Arguments

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)

Value

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)


disto documentation built on May 2, 2019, 4:06 p.m.