petition_term_document_matrix: Calculates the TermDocumentMatrix for petitions.

Description Usage Arguments Value Examples

Description

Calculates the TermDocumentMatrix for petitions.

Usage

1

Arguments

petitions

data.frame of petitions

column

which column from the petitions to use for the word cloud (e.g. 'body', 'title')

Value

TermDocumentMatrix the tdm of the given petition column

Examples

1
2
3
4
5
6
7
data(petitions)
petitions <- head(petitions)
petition_body_tdm <- petition_term_document_matrix(petitions, 'body')
petition_title_tdm <- petition_term_document_matrix(petitions, 'title')

petitions$body_and_title <- paste(petitions$body, petitions$title, sep="\n")
petition_body_and_title_tdm <- petition_term_document_matrix(petitions, 'body_and_title')

yoni/r_we_the_people documentation built on May 4, 2019, 5:31 p.m.