Description Usage Arguments Value Examples
Fit a kmeans cluster to text data. Prior to distance measures being
calculated the tf-idf (see weightTfIdf
) is applied to the
DocumentTermMatrix
.
1 2 3 4 | kmeans_cluster(x, k, ...)
## S3 method for class 'data_store'
kmeans_cluster(x, k, ...)
|
x |
A data store object (see |
k |
The number of clusters. |
... |
Other arguments passed to |
Returns an object of class "kmeans"
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | ## Not run:
library(dplyr)
x <- with(
presidential_debates_2012,
data_store(dialogue, paste(person, time, sep = "_"))
)
## 6 topic model
kmeans_cluster(x, k=6)
kmeans_cluster(x, k=6) %>%
assign_cluster()
kmeans_cluster(x, k=6) %>%
assign_cluster() %>%
summary()
x2 <- presidential_debates_2012 %>%
with(data_store(dialogue))
myfit2 <- kmeans_cluster(x2, 55)
assign_cluster(myfit2)
assign_cluster(myfit2) %>%
summary()
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.