concatenate: Concatenate

View source: R/concatenate.r

concatenateR Documentation

Concatenate

Description

A quick utility for concatenating strings together. This is handy because if you want to generate the n-grams for several different texts, you must first put them into a single string unless the text is composed of sentences that should not be joined.

Usage

concatenate(..., collapse = " ", rm.space = FALSE)

Arguments

...

Input text(s).

collapse

A character to separate the input strings if a vector of strings is supplied; otherwise this does nothing.

rm.space

logical; determines if spaces should be removed from the final string.

Value

A string.

See Also

preprocess

Examples

library(ngram)

words = c("a", "b", "c")
wordcount(words)
str = concatenate(words)
wordcount(str)


wrathematics/ngram documentation built on Jan. 28, 2024, 12:14 p.m.