dis_entities: A procedure to create a disparity matrix between entities

Description Usage Arguments Value Examples

View source: R/diversity.R

Description

Takes a data frame or a matrix to create a disparity matrix

Usage

1
dis_entities(data, method = "euclidean", category_row = FALSE)

Arguments

data

A numeric matrix with entities i in the rows and categories j in the columns. Cells show the respective value (value of abundance) of entity i in the category j. It can also be a transpose of the previous matrix, that is, a matrix with categories in the rows and entities in the columns. Yet in that case, the argument "category_row" has to be set to TRUE. The matrix must include names for the rows and the columns. The argument "data", also accepts a dataframe with three columns in the following order: entity, category and value.

method

A distance or dissimilarity method available in "proxy" package as for example "Euclidean", "Kullback" or "Canberra". This argument also accepts a similarity method available in the "proxy" package, as for example: "cosine", "correlation" or "Jaccard" among others. In the latter case, a correspondent transformation to a dissimilarity measure will be retrieved. A list of available methods can be queried by using the function pr_DB. e.g. summary(pr_DB). The default value is Euclidean distance.

category_row

A flag to indicate that categories are in the rows. The analysis assumes that the categories are in the columns of the matrix. If the categories are in the rows and the entities in the columns, then the argument "category_row" has to be set to TRUE. The default value is FALSE.

Value

A distance or dissimilarity square matrix

Examples

1
2
3
Xdis <- dis_entities(pantheon)
#for science dataset
dis_entities(scidat, method='cosine')

diverse documentation built on May 2, 2019, 2:10 a.m.