Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
julmeran
Partner - Contributor
Partner - Contributor

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 (5)
1 Reply
abinayababu
Contributor II
Contributor II

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