The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.

Type: Package
Title: Distance Object Manipulation Tools
Version: 0.1.8
Maintainer: Zachary Colburn <zcolburn@gmail.com>
Description: Provides convenient methods for accessing the data in 'dist' objects with minimal memory and computational overhead. 'disttools' can be used to extract the distance between any pair or combination of points encoded by a 'dist' object using only the indices of those points. This is an improvement over existing functionality, which requires either coercing a 'dist' object into a matrix or calculating the one dimensional index corresponding to a pair of observations. Coercion to a matrix is undesirable because doing so doubles the amount of memory required for storage. In contrast, there is no inherent downside to the latter solution. However, in part due to several edge cases, correctly and efficiently implementing such a solution can be challenging. 'disttools' abstracts away these challenges and provides a simple interface to access the data in a 'dist' object using the latter approach.
License: MIT + file LICENSE
Encoding: UTF-8
Suggests: covr, testthat, knitr, rmarkdown
RoxygenNote: 7.1.2
VignetteBuilder: knitr
NeedsCompilation: no
Packaged: 2022-02-04 19:41:14 UTC; zcolburn
Author: Zachary Colburn [aut, cre], Madigan Army Medical Center - Department of Clinical Investigation [cph, fnd]
Repository: CRAN
Date/Publication: 2022-02-05 00:20:05 UTC

Retrieve the distances between i and j from a 'dist' object.

Description

Retrieve the distances between i and j from a 'dist' object.

Usage

get_dists(x, i, j = NULL, return_indices = FALSE)

Arguments

x

An object of class 'dist'.

i

Either a two column matrix of integer indices or a vector of indices that are paired with the corresponding elements in j.

j

A vector of indices where each element forms a pair with the corresponding element in argument i.

return_indices

Logical indicating whether a three column matrix containing the provided indices (columns 1 and 2) and their corresponding distances (column 3) should be returned. The default behavior is to return a vector of distances.

Value

A vector giving the distances between the provided indices.

Examples

test <- matrix(rnorm(20), ncol = 2)
test_dists <- dist(test)
indices <- matrix(sample(1:8),ncol=2)
get_dists(test_dists, indices)

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.