distanceSubMatrix <-
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.