Learn R Programming

clickstream (version 1.1.8)

clusterClickstreams: Performs K-Means Clustering on a List of Clickstreams

Description

Performs k-means clustering on a list of clickstreams. For each clickstream a transition matrix of a given order is computed. These transition matrices are used as input for performing k-means clustering.

Usage

clusterClickstreams(clickstreamList, order = 0, centers, ...)

Arguments

clickstreamList
A list of clickstreams for which the cluster analysis is performed.
order
The order of the transition matrices used as input for clustering (default is 0; 0 and 1 are possible).
centers
The number of clusters.
...
Additional parameters for k- means clustering (see kmeans).

Value

This method returns a ClickstreamClusters object (S3-class). It is a list with the following components:
clusters
The resulting list of Clickstreams objects.
centers
A matrix of cluster centres.
states
Vector of states
totss
The total sum of squares.
withinss
Vector of within- cluster sum of squares, one component per cluster.
tot.withinss
Total within-cluster sum of squares, i.e., sum(withinss).
betweenss
The between- cluster sum of squares, i.e., totss - tot.withinss.

See Also

print.ClickstreamClusters, summary.ClickstreamClusters

Examples

Run this code

clickstreams <- c("User1,h,c,c,p,c,h,c,p,p,c,p,p,o",
               "User2,i,c,i,c,c,c,d",
               "User3,h,i,c,i,c,p,c,c,p,c,c,i,d",
               "User4,c,c,p,c,d",
               "User5,h,c,c,p,p,c,p,p,p,i,p,o",
               "User6,i,h,c,c,p,p,c,p,c,d")
csf <- tempfile()
writeLines(clickstreams, csf)
cls <- readClickstreams(csf, header = TRUE)
clusters <- clusterClickstreams(cls, order = 0, centers = 2)
print(clusters)

Run the code above in your browser using DataLab