Description Usage Arguments Examples
This function does not really remove sparse words (which is what
tm::removeSparseTerms
does); rather, it only shows how
many words are left when you specify some sparse values.
See Examples.
1 | sparse_left(x, sparse)
|
x |
a DocumentTermMatrix or TermDocumentMatrix object. |
sparse |
a numeric vector with elements >= 0 and <= 1. |
1 2 3 4 5 6 7 8 9 | x <- c(
"Hello, what do you want to drink?",
"drink a bottle of milk",
"drink a cup of coffee",
"drink some water")
dtm <- corp_or_dtm(x, from = "v", type = "dtm")
y <- sparse_left(dtm, seq(0, 1, 0.1))
# Then you can use plot(sort(y, decreasing = TRUE), type = "b") to
# see which sparse value is proper.
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.