Learn R Programming

clickstream (version 1.3.0)

predict.ClickstreamClusters: Predicts the Cluster for a Given Pattern Object

Description

Predicts the cluster for a given Pattern object. Potential clusters need to be identified with the method clusterClickstreams before predicting the cluster.

Usage

# S3 method for ClickstreamClusters
predict(object, pattern, ...)

Arguments

object

A ClickstreamClusters object containing the clusters. ClickstreamClusters represent the result of a cluster analysis on a list of clickstreams (see clusterClickstreams).

pattern

Sequence of a user's initial clicks as Pattern object.

...

Ignored parameters.

Value

Returns the index of the clusters to which the given Pattern object most probably belongs to.

See Also

clusterClickstreams, print.ClickstreamClusters

Examples

Run this code
# NOT RUN {
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)
pattern <- new("Pattern", sequence = c("h", "c"))
predict(clusters, pattern)

# }

Run the code above in your browser using DataLab