bigdist_extract {bigdist}R Documentation

Extract parts of bigdist

Description

Extract parts of bigdist

Usage

bigdist_extract(x, i, j, k, product = "outer")

Arguments

x

Object of class 'bigdist'

i

(integer vector) row positions

j

(integer vector) column positions

k

(integer vector) positions

product

(string) One among: 'inner', 'outer'(default)

Details

In k-mode, both i and j should be missing and k should not be missing. In ij-mode, k should be missing and both i and j are optional. If i or j are missing, they are interpreted as all values of i or j (similar to matrix or dataframe subsetting).

Value

A matrix or vector of distances when product is 'outer' and 'inner' respectively

Examples

set.seed(1)
amat <- matrix(rnorm(1e3), ncol = 10)
td   <- tempdir()
temp <- bigdist(mat = amat, file = file.path(td, "temp_ex6"))
bigdist_extract(temp, 1, 2)
bigdist_extract(temp, 1:2, 3:4)
bigdist_extract(temp, 1:2, 3:4, product = "inner")
dim(bigdist_extract(temp, 1:2,))
dim(bigdist_extract(temp, , 3:4))

[Package bigdist version 0.1.4 Index]