The k-medoids in the clara () function use distance to create clusters, so I get this pattern:
a <- matrix(c(0,1,3,2,0,.32,1,.5,0,.35,1.2,.4,.5,.3,.2,.1,.5,.2,0,-.1), byrow=T, nrow=5)
cl <- clara(a,2)
matplot(t(a),type="b", pch=20, col=cl$clustering)

But I want to find a clustering method that assigns a cluster to each row according to its trend, so rows 1, 2 and 3 belong to one cluster, and rows 4 and 5 to another.
source
share