compose: Compose Vectors

Description Usage Arguments Examples

View source: R/compose.R

Description

Performs vector composition and negation, then returns the 12 most similar terms.

Usage

1
2
compose(mat, positive = "", negative = "", operation = "*",
  fullResults = T, method = "cosine", margin = 1, threshold = 0)

Arguments

mat

A term-document or word-context matrix (format either matrix or docMatrix).

positive

A character vector of terms naming the rows to be aggregated.

operation

A character vector (either "+" or "*"), that controls whether the vectors will be added as simple sums or as products. Default is "*".

fullResults

A logical value. If TRUE, the composite vector will be returned, without computing similarity scores. If FALSE, only terms most similar to the composite vector will be returned.

method

The calculation to be performed ("cosine", "euclidean", "pearson", or "covariance").

margin

A numeric value. If margin = 1 then rows will be computed. Note that the current development version of this function only supported computing over rows, so don't change this parameter.

threshold

A numeric value, between 0 and 100. See similarity for more details.

Examples

1
2
data(eebo)
compose(mat = eebo, positive = c("wit", "sense"))

michaelgavin/empson documentation built on May 22, 2019, 9:50 p.m.