View source: R/distanceMatrix.R
1 | distanceMatrix(N, P)
|
N |
|
P |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | ##---- 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, P)
{
d_hor = (matrix(rep(cumsum(matrix(1, 2 * N + 1, 1)), 2 *
P + 1), nrow = 2 * N + 1) - N - 1)^2
d_ver = (matrix(rep(cumsum(matrix(1, 2 * P + 1, 1)), 2 *
N + 1), ncol = 2 * P + 1, byrow = TRUE) - P - 1)^2
w = sqrt(d_hor + d_ver)
return(w)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.