sig: Return the signatures from a matrix

Description Usage Arguments Value What it does Examples

View source: R/sig.R

Description

Prints the sorted values from a term-document or word-context matrix

Usage

1
sig(mat, keyword, margin = 1, fullResults = F)

Arguments

mat

A term-document or word-context matrix.

keyword

The term you are evaluating, either a keyword or document name.

margin

Numeric value: 1 or 2. If 1, calculations are performed over the rows. If 2, over the columns.

fullResults

Logical value. Default is false.

Value

If fullResults is true, all results are included in a full-length vector. If false, only the 12 top words will display.

What it does

Sorts and prints the most frequent collocates for words and documents. In a term- document matrix, it will return either the word counts for a document or the top documents for a given word.

In a word-context matrix, the relationship is similar. Selecting margin = 2 will find the keyword's column, then return the word counts of the concordance for that term (assuming that it was among the keywords used to build the matrix). Selecting margin = 1 will return the keyword's row, showing in which concordances it had the highest representation.

For comparison, see the example of 'rights' given below.

Examples

1
2
3
4
5
6
7
8
9
# For most frequent collocates in a word-context matrix
data(eebo)
sig(mat = eebo, keyword = "rights", margin = 1)
sig(eebo, "rights", margin = 2)

# For most frequent words in a document
data(shakespeare)
sig(mat = shakespeare, vec = "TN", margin = 2)
sig(shakespeare, "wife", margin = 1)

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