Calculate nearest-neighbour distances

calcNNdists(obj, nnn = 1, act = FALSE)

# S3 method for arcosTS
calcNNdists(obj, nnn = 1, act = FALSE)

Arguments

obj

an arcosTS object.

nnn

an integer, sets the n-th nearest neighbour; default 1.

act

logical, if TRUE, the NN distance is calculated only on active objects, i.e. those with binarised measurement not smaller than 1; default FALSE.

Value

a data.table

Details

Wrapper for the calcVecNNdists function.

Examples

library(ARCOS)
library(data.table)
ts = data.table(frame = c(1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 5, 5),
                objid = c(1, 2, 1, 2, 3, 1, 2, 3, 4, 1, 2, 4, 1, 4),
                x = c(1, 3, 1.2, 2.5, 3.5, 0.9, 2.6, 2.9, 3.2, 1.1, 2.8, 3.1, 1, 3))

arcosTS(ts,
        colPos = "x",
        col = list(Frame = "frame",
                   IDobj = "objid",
                   RT = NULL,
                   IDcoll = NULL),
        interVal = 1.,
        interType = "fixed")
#> Error in arcosTS(ts, colPos = "x", col = list(Frame = "frame", IDobj = "objid",     RT = NULL, IDcoll = NULL), interVal = 1, interType = "fixed"): argument 3 matches multiple formal arguments

nnDists = calcNNdists(ts)
#> Error in UseMethod("calcNNdists"): no applicable method for 'calcNNdists' applied to an object of class "c('data.table', 'data.frame')"