I got the clusters for clickstreams using following code
library(clickstream)
clkstrm <- read.csv("C:clickstream.csv", sep = ",", header = TRUE)
newchar <- as.character(clkstrm$clkstrm)
csf <- tempfile()
writeLines(newchar, csf)
cls <- readClickstreams(csf, header = TRUE)
clusters <- clusterClickstreams(cls, order = 0, centers = 10)
print(clusters)
plot(clusters)
I can print the clusters and have a look at them but plot(clusters) is giving error. I wanted to plot these clusters so that I can analyse it in a better way and present it to stakeholders. I would really appreciate if someone can help me to plot this. Thanks
Usually when you program a class - in this case "ClickstreamClusters" then you define plot.ClassName and the author didnt do it. Hence it doesnt plot anything.
If you have a look what the final object comprises off, maybe you can plot it yourself. Just go str
List of 8
$ clusters :List of 2
..$ :List of 3
.. ..$ User1: chr [1:13] "h" "c" "c" "p" ...
.. ..$ User5: chr [1:12] "h" "c" "c" "p" ...
.. ..$ User6: chr [1:10] "i" "h" "c" "c" ...
.. ..- attr(*, "class")= chr "Clickstreams"
..$ :List of 3
.. ..$ User2: chr [1:7] "i" "c" "i" "c" ...
.. ..$ User3: chr [1:13] "h" "i" "c" "i" ...
.. ..$ User4: chr [1:5] "c" "c" "p" "c" ...
.. ..- attr(*, "class")= chr "Clickstreams"
$ centers : num [1:2, 1:6] 0.1124 0.0256 0.3449 0.5443 0.3949 ...
..- attr(*, "dimnames")=List of 2
.. ..$ : chr [1:2] "1" "2"
.. ..$ : chr [1:6] "h" "c" "p" "o" ...
$ states : chr [1:6] "h" "c" "p" "o" ...
$ totss : num 0.369
$ withinss : num [1:2] 0.0532 0.0901
$ tot.withinss: num 0.143
$ betweenss : num 0.226
$ order : num 0
- attr(*, "class")= chr "ClickstreamClusters"
And from this you could plot something and get the values using the $ operator. I.E. clusters$centers will give you the 2x6 matrix of centres and you can plot it. If you describe what sort of plot you want, maybe could help you, although I never plotted clustersmyself. Or you can have a look at other clustering packages that do plotting and connect them somehow.