bigdist_replace {bigdist} | R Documentation |
Replace parts of bigdist
bigdist_replace(x, i, j, value, k)
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 |
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.
bigdist object
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")