dist_extract: Extract distances between specified indexes from a 'dist'...

Description Usage Arguments Details Value Examples

View source: R/dist_extract.R

Description

Extract distances as a vector when product is inner and as a matrix when the product is outer

Usage

1
dist_extract(object, i, j, product = "inner")

Arguments

object

distance object

i

index

j

index. If missing, this defaults to 1:size of the dist object

product

(string) product type. One among: 'inner', 'outer'.

Details

When j is missing, it defaults to 1:size of the dist object. When the product is inner and lengths of i and j mismatch, the smaller one is extended to the size of the onger one.

Value

A vector of distances when 'inner' is used. A matrix of distances when 'outer' is used.

Examples

1
2
3
temp <- stats::dist(datasets::mtcars)
dist_extract(temp, 1:2, 3:5, "inner")
dist_extract(temp, 1:2, 3:5, "outer")

talegari/forager documentation built on May 3, 2019, 4:01 p.m.