At the moment I have two matrices in R which both hold a number of products and their time series based on 2 variables(Sales and Inventory)

There are 4000 products per set and all time series have t-75. I want to cluster the products together on the basis of both variables. I have looked at Tclust package, PDC, and more but I don't get it working. Any help?

To summarise how can we cluster 4000 product based on 2 different time series data which is sales and inventory

Below is an example of the dummy data. ID column is number of months.

So the first set (with variable sales) and looks like:

enter image description here

And the second set is similar (but then with variable inventory) and looks like:

enter image description here


1 Answer 1


From the top of my mind, you can t(as.matrix(rbind(table1, table2))) to get one table where rows are products and columns are both sales and inventories by month.

A choice of clustering algorithm is up to you, but again as a top of the mind you can use r stats::hclust to perform hierarchical analysis and visualize the dendrogram.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.