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_fun = sum)# S3 method for character
wordcount(x, sep = " ", count_fun = sum)
# S3 method for ngram
wordcount(x, sep = " ", count_fun = sum)
A count.
A string or vector of strings, or an ngram object.
The characters used to separate words.
The function to use for aggregation if x
has length greater than 1.
Useful ones include sum
and identity
.
preprocess
library(ngram)
words = c("a", "b", "c")
words
wordcount(words)
str = concatenate(words, collapse="")
str
wordcount(str)
Run the code above in your browser using DataLab