wordcount | 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_fun = sum)
## S3 method for class 'character'
wordcount(x, sep = " ", count_fun = sum)
## S3 method for class 'ngram'
wordcount(x, sep = " ", count_fun = sum)
x |
A string or vector of strings, or an ngram object. |
sep |
The characters used to separate words. |
count_fun |
The function to use for aggregation if |
A count.
preprocess
library(ngram)
words = c("a", "b", "c")
words
wordcount(words)
str = concatenate(words, collapse="")
str
wordcount(str)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.