Learn R Programming

bigdist (version 0.1.4)

bigdist_replace: Replace parts of bigdist

Description

Replace parts of bigdist

Usage

bigdist_replace(x, i, j, value, k)

Arguments

x

Object of class 'bigdist'

i

(integer vector) row positions

j

(integer vector) column positions

value

(integer/numeric vector) Values to replace

k

(integer vector) positions

Value

bigdist object

Details

There are two modes to specify the positions:

  • ij-mode where i and j are specified and k is missing. If i or j are missing, they are interpreted as all values of i or j (similar to matrix or dataframe subsetting). Lengths of i, j are required to be same. If 'value' is singleton, then it is extended to the length of i or j. Else, 'value' should have same length as i or j.

  • k-mode where k is present and both i and k are missing. k is the positions in the dist object. If 'value' is singleton, then it is extended to the length of k. Else, 'value' should have same length as k.

Examples

Run this code
# NOT RUN {
set.seed(1)
amat <- matrix(rnorm(1e3), ncol = 10)
td   <- tempdir()
temp <- bigdist(mat = amat, file = file.path(td, "temp_ex7"))
bigdist_replace(temp, 1, 2, 10)
bigdist_extract(temp, 1, 2)
bigdist_replace(temp, 1:2, 3:4, 11:12)
bigdist_extract(temp, 1:2, 3:4, product = "inner")
# }

Run the code above in your browser using DataLab