Learn R Programming

textreg (version 0.1.3)

make.count.table: Count number of times documents have a given phrase.

Description

Given a list of phrases, count how many documents they appear in and subdivide by positive and negative appearance.

Usage

make.count.table(phrases, labeling, corpus)

Arguments

phrases
List of strings
labeling
Vector of +1/0/-1 labels
corpus
A corpus object from tm package

Value

a dataframe of statistics. per.pos is the percent of the documents with the phrase that are positively labeled. per.tag is the percent of the positively labeled documents that have the phrase.

Details

This method does not consider multiple counts of phrases within documents. Phrases can have wildcards and stemming notation. See grab.fragments.

See Also

grab.fragments

Other textregCounting: make.phrase.matrix; phrase.count

Examples

Run this code
library( tm )
data( bathtub )
lbl = meta( bathtub )$meth.chl
make.count.table( c("bathtub","strip+", "vapor *"), lbl, bathtub )

Run the code above in your browser using DataLab