make.phantoms: Add Phantom Rows and Columns

Description Usage Arguments Details Value Author(s) See Also Examples

Description

The make.phantoms function will take an NxN matrix and add NP phantom elements, thus creating a matrix with N+NPxN+NP dimensions.

Usage

1
make.phantoms(x, nphantoms, name = "phantom", maxval = Inf, ...)

Arguments

x

A matrix or data.frame object, with NxN dimensions.

nphantoms

An integer, providing the number of phantom elements to add.

name

A character string, indicating the name attribute for new elements. Defaults to "phantom".

maxval

An integer value, the default value to give the pairs of phantoms (indeces [N+1:N+NP, N+1:N+NP]), assumed to be a maximum distance. Defaults to Inf.

...

Additional arguments, not used at this time.

Details

This function is internal to the gendistance function, but may be useful in manufacturing personalized distance matrices. Phantoms are fake elements that perfectly match all elements. They can be used to discard a certain number of elements.

Value

a matrix or data.frame object

Author(s)

Cole Beck

See Also

gendistance distancematrix

Examples

1
2
3
4
5
6
7
8
# 5x5 distance matrix
dist.mat <- matrix(c(0,5,10,15,20,5,0,15,25,35,10,15,0,25,40,15,25,25,0,15,20,35,40,15,0), nrow=5)
# add one phantom element
dm.ph <- make.phantoms(dist.mat, 1)
# create distancematrix object
distancematrix(dm.ph)
# add three phantoms
make.phantoms(dist.mat, 3)

nbpMatching documentation built on May 29, 2017, 7:22 p.m.