prepare_textcorpus_data: Perpare a Corpus Data Set for Inclusion in the 'textcorpus'...

Description Usage Arguments Value Examples

Description

Prepare a corpus data.frame for inclusion in the textcorpus package.

Usage

1
2
prepare_textcorpus_data(x, corpus.cols = c("id", "author", "text"),
  meta = NULL, ...)

Arguments

x

The main corpus data set.

corpus.cols

The corpus columns found in x. At the very least c('id', 'author', 'text') are required columns. The user may supply the entire data set for x and specify meta data columns to peel off and make distinct or may pass a reduced number of columns to x and pass the matching meta data through the meta argument.

meta

The optional meta data set.

...

ignored.

Value

Returns a list of a main corpus text data and meta data with a matching 'id' key.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
library(dplyr)
library(stringi)

corp <- data_frame(
    id = stri_rand_strings(10, 10),
    author = c('sam', 'cal', 'sue', 'bob', 'sal', 'pam', 'pat', 'joe', 'arr', 'nmr'),
    text = stri_rand_lipsum(10),
    state = state.name[1:10],
    month = month.name[1:10]
)

prepare_textcorpus_data(corp)
prepare_textcorpus_data(corp, corpus.cols = c('id', 'author', 'text', 'state'))

trinker/textcorpus documentation built on June 1, 2019, 12:53 a.m.