0
votes

I'm using R package "cluster" in Power BI to cluster customers from their historical transactions.

My data looks like this:

enter image description here

Using Run R-Script command in Power Query Editor, I have the following code:

library(cluster)

k.means.fit_log <- kmeans(dataset[2:4], 3)

output<-dataset
output$cluster <- k.means.fit_log$cluster

After this code is executed, I get an additional column with the number of the cluster and all looks good.

However, k.means.fit_log is a list with 9 rows, that contains the cluster centers, size, etc. so I'd like to be able to create another table or tables in Power BI with the contents of that object.

How can I achieve this?

Thanks in advance for your help!

1

1 Answers

0
votes

If it is a list, and delimited, you can use the spilt function in Power Query. It would be good to share the R outputed table in your question