Qlik Community

Qlik Server Side Extensions Discussions

Discussion Board for collaboration on Server-Side Extensions and Advanced Analytics Integration.

Highlighted
Partner
Partner

R in Qlik Sense: K-Means on Iris Data in Script

Hello,

i already integrated R in Qlik Sense and used the k-means algorithm for clustering the Iris Dataset. That works perfekt, when i do it in the diagram.

When i write the following Code, R returns:  "Rserve Traceback: stop("more cluster centers than distinct data points.")".

When i use the same k-means-command to color the scatter plot, it works fine.

This is my script:

[Iris]:
LOAD
    observation,
    "sepal length" as seplen,
    "sepal width" as sepwid,
    "petal length" as petlen ,
    "petal width" as petwid
FROM [lib://Data/Iris.csv];

[KMeans]:
Load
observation as observation,
petlen as petlen,
petwid as petwid,
R.ScriptEval('kmeans(cbind(q$petlen, q$petwid), 2 , nstart = 10)$cluster ;', petlen , petwid)
Resident [Iris] ;

 

Any help is appreciated.

Labels (4)
1 Reply
abinayababu
New Contributor II

Re: R in Qlik Sense: K-Means on Iris Data in Script

HI , COULD YOU PLEASE SHARE STEP BY STEP INTEGRATION OF R EXTENSION IN QLIK SENSE
I WILL REALLY APPERCIATEIF YOU COULD SHARE DETAILS