View source: R/distanceSubMatrix.R
1 | distanceSubMatrix(n_rows, n_cols, raster_cols, row_offset, col_offset)
|
n_rows |
|
n_cols |
|
raster_cols |
|
row_offset |
|
col_offset |
1 2 3 4 5 6 7 8 9 10 11 12 13 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (n_rows, n_cols, raster_cols, row_offset, col_offset)
{
di = matrix(rep(cumsum(rep(1, n_rows)), n_cols), nrow = n_rows) +
row_offset
dj = matrix(rep(cumsum(rep(1, n_cols)), n_rows), nrow = n_rows,
byrow = TRUE) + col_offset
return(sqrt((abs(di - dj)%/%raster_cols)^2 + (abs(di - dj)%%raster_cols)^2))
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.