term.freq: Get a table of term frequencies

Description Usage Arguments Value Examples

View source: R/text.R

Description

Get a table of term frequencies.

Usage

1
2
3
4
5
6
7
term.freq( d, 
		topN = 0, 
		percent = 0,
		sorted = c("none", "alpha", "freq"),
		decreasing = FALSE,
		useDocFreq = FALSE,		
		minFreq = 1 )

Arguments

d

The corpus from which term frequencies are calculated.

topN

If specified, only the 'topN' most frequent terms are returned. If more terms are requested than available, all terms are returned. If both 'topN' and 'percent' are zero, then all terms are returned.

percent

If specified, only the top 'percent' % most frequent terms are returned. If more terms are requested than available, all terms are returned. If both 'topN' and 'percent' are zero, then all terms are returned.

sorted

A string specifying how to sort the terms. 'none' for no sorting, 'alpha' for alphanumeric sorting, and 'freq' for sorting by frequency.

decreasing

If TRUE, terms are sorted in decreasing order, if FALSE, sorted ascending order.

useDocFreq

If TRUE, the returned frequencies are for the total number of documents in which the term occurs. If false, they are the total number of occurrences.

minFreq

Terms with *TOTAL* frequencies below this threshold will not be included in the output.

Value

A name vector of the term frequencies.

Examples

1
2
3
4
if(require(tm)){
data(crude)
term.freq(d=crude, percent=0, topN=10, minFreq=0,useDocFreq=FALSE,sorted="alpha", decreasing=TRUE)
}

DeducerText documentation built on May 2, 2019, 5:44 p.m.