Free Access Week - Data Engineering + BI
Data Engineering and BI courses are free this week!
Free Access Week - Jun 2-8

mefa (version 3.1-0)

dist2vec: Manipulation Tools for Class 'dist'

Description

Converts a 'dist' object into vector and vice versa.

Usage

vec2dist(x, size, labels = NULL, diag = FALSE, upper = FALSE, call = FALSE, method = NULL)
dist2vec(x)
is.dist(x)
## S3 method for class 'dist':
as.data.frame(x, row.names = NULL, optional = FALSE, ...)

Arguments

x
A vector or a 'dist' object.
size
Integer, the number of observations in the dataset (see dist).
labels, diag, upper, call, method
Logical, setting attributes of the distance object (see dist).
row.names
Row names for the resulting data frame.
optional
Argument not yet used.
...
Other arguments passed to functions.

Value

  • vec2dist returns an object of class dist. dist2vec returns a vector. is.dist returns a logical statement about the class of the object. as.data.frame.dist returns a data frame with comuns row for row id's, col for column id's and dist for the distance values.

encoding

UTF-8

References

S'olymos{Solymos} P. (2008) mefa: an R package for handling and reporting count data. Community Ecology 9, 125--127. S'olymos{Solymos} P. (2009) Processing ecological data in R with the mefa package. Journal of Statistical Software 29(8), 1--28. http://www.jstatsoft.org/v29/i08/ http://mefa.r-forge.r-project.org/

Examples

Run this code
vec2dist(1:3, 3)
vec2dist(1:3, 3, diag = TRUE)
vec2dist(1:3, 3, diag = TRUE, upper = TRUE)
vec2dist(1:3, 3, labels=letters[1:3])
(x <- dist(1:5))
is.dist(x)
dist2vec(x)
as.data.frame(x)

Run the code above in your browser using DataLab