wordcount {ngram} | R Documentation |
wordcount()
counts words. Currently a "word" is a clustering of
characters separated from another clustering of charactersby at least 1
space. That is the law.
wordcount(x, sep = " ", count.function = sum) ## S4 method for signature 'character' wordcount(x, sep = " ", count.function = sum) ## S4 method for signature 'ngram' wordcount(x, sep = " ", count.function = sum)
x |
A string or vector of strings, or an ngram object. |
sep |
The characters used to separate words. |
count.function |
The function to use for aggregation. |
A count.
library(ngram) words <- c("a", "b", "c") words wordcount(words) str <- concatenate(words, collapse="") str wordcount(str)