skmeans_cluster: Fit a skmean Cluster

Description Usage Arguments Value Examples

Description

Fit a skmean cluster to text data. Prior to distance measures being calculated the tf-idf (see weightTfIdf) is applied to the DocumentTermMatrix. Cosine dissimilarity is used to generate the distance matrix supplied to skmeans.

Usage

1
2
3
4
skmeans_cluster(x, k, ...)

## S3 method for class 'data_store'
skmeans_cluster(x, k, ...)

Arguments

x

A data store object (see data_store).

k

The number of clusters.

...

Other arguments passed to skmeans.

Value

Returns an object of class "skmean".

Examples

 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
library(dplyr)

x <- with(
    presidential_debates_2012,
    data_store(dialogue, paste(person, time, sep = "_"))
)


## 6 topic model
myfit1 <- skmeans_cluster(x, k=6)

myfit1 %>%
    assign_cluster()

myfit1 %>%
    assign_cluster() %>%
    summary()

## Not run: 
x2 <- presidential_debates_2012 %>%
    with(data_store(dialogue))

myfit2 <- skmeans_cluster(x2, 55)

assign_cluster(myfit2)

assign_cluster(myfit2) %>%
    summary()

## End(Not run)

trinker/clustext documentation built on May 31, 2019, 8:41 p.m.