powered by
Efficiently computes 1D-indexing from 2D-indexing
get1dFrom2d(i,j, N)
An integer specifying the 1d index
An integer specifying the row index
An integer specifying the column index - must be different from i as "dist" object does not store the diagonal entries.
The number of observations in the original data matrix
Minh Long Nguyen edelweiss611428@gmail.com
Converts 2D indexing (a row-column pair) into 1D indexing (as used in R's "dist" objects), given the number of observations N.
Currently, name-based indexing is not supported."
N = 5 for(i in 1:4){ for(j in (i+1):5){ print(get1dFrom2d(i,j,N)) } }
Run the code above in your browser using DataLab