Extract parts of bigdist
bigdist_extract(x, i, j, k, product = "outer")
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) |
A matrix or vector of distances when product is 'outer' and 'inner' respectively
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).
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)#> [,1] #> [1,] 4.631341bigdist_extract(temp, 1:2, 3:4)#> [,1] [,2] #> [1,] 3.976406 3.531089 #> [2,] 5.591309 4.661480bigdist_extract(temp, 1:2, 3:4, product = "inner")#> [1] 3.976406 4.661480#> [1] 2 100#> [1] 100 2