dtm: Document term frequency

Description Usage Arguments Value Examples

View source: R/wactor-s3.R

Description

Converts character vector into document term matrix (dtm)

Usage

1
dtm(object, .x = NULL)

Arguments

object

Input object containing dictionary (column), e.g., wactor

.x

Text from which the document term matrix will be created

Value

A c-style matrix

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## create wactor
w <- wactor(letters)

## use wactor to create dtm of same vector
dtm(w, letters)

## using the initial data is the default; so you don't actually have to
## respecify it
dtm(w)

## use wactor to create dtm on new vector
dtm(w, c("a", "e", "i", "o", "u"))

## apply directly to character vector
dtm(letters)

wactor documentation built on Dec. 18, 2019, 5:07 p.m.