## load a MRIaggr object
data("MRIaggr.Pat1_red", package = "MRIaggr")
## search for a neighbourhood matrix
# selectW(MRIaggr.Pat1_red) # no neighbourhood matrix
## compute the neighbourhood matrix
resW <- calcW(object = MRIaggr.Pat1_red, range = sqrt(2))
## store it
allocW(MRIaggr.Pat1_red, type = "Wmatrix") <- list(Wmatrix = resW$W)
## it is automatically performed when specifying update.object = TRUE
calcW(object = MRIaggr.Pat1_red, range = sqrt(2), update.object = TRUE, overwrite = TRUE)
Run the code above in your browser using DataLab