Learn R Programming

dissimilarities (version 0.3.0)

get2dFrom1d: 1D-indexing to 2D-indexing

Description

Efficiently computes 2D-indexing from 1D-indexing

Usage

get2dFrom1d(idx1d, N)

Value

An integer matrix storing the corresponding 2D indexes.

Arguments

idx1d

An integer vector of 1D indexes

N

The number of observations in the original data matrix

Author

Minh Long Nguyen edelweiss611428@gmail.com

Details

Converts 1D indexing (as used in R's "dist" objects) into 2D indexing (row-column pairs) for a distance matrix of size \(N \times N\).

Currently, name-based indexing is not supported."

Examples

Run this code

get2dFrom1d(1:10, 5)

Run the code above in your browser using DataLab