<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Qlik AAI: Clustering in R, kmeans in Integration, Extension &amp; APIs</title>
    <link>https://community.qlik.com/t5/Integration-Extension-APIs/Qlik-AAI-Clustering-in-R-kmeans/m-p/1438290#M14438</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Simone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The labeling of the bubbles in your scatter chart is something you control in the R expression. This is an option in the chart-type itself. Look under presentation-&amp;gt; labels&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regard,&lt;/P&gt;&lt;P&gt;Bas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 13 Nov 2017 07:46:17 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2017-11-13T07:46:17Z</dc:date>
    <item>
      <title>Qlik AAI: Clustering in R, kmeans</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Qlik-AAI-Clustering-in-R-kmeans/m-p/1438288#M14436</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi community,&lt;/P&gt;&lt;P&gt;I'm playing with R and Qlik Sense Desktop, using this very excellent example, the kmeans app given by &lt;SPAN style="font-size: 13.3333px;"&gt; &lt;/SPAN&gt;&lt;A href="https://community.qlik.com/qlik-users/2597" target="_blank"&gt;deh&lt;/A&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;,&lt;/SPAN&gt; . Here the original app and the data, you can find a modified app attached also to my post.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://community.qlik.com/docs/DOC-18787#comment-63411" title="https://community.qlik.com/docs/DOC-18787#comment-63411" target="_blank"&gt;https://community.qlik.com/docs/DOC-18787#comment-63411&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The app uses the famous iris data, to perform in Qlik Sense a kmeans clustering of the observations (each observation is have four quantitative continue variables occurrencies, and a qualitative variable occurency, the species of the iris flowers): the result is a nice scatterplot that have on the axis a pair of the quantitative variables, as dots the observations, and as colour the cluster.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My goal is to have on the dots, the species of the iris (3 species), clearly with a reasonable number of cluster (1). As you can understand my goal is not to have an analysis with a meaning, but test the sistem to see how much is flexible.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I simply put the species in the dimension panel in Qlik and the result is an error, something like "the client has not a valid argument".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Looking the &lt;SPAN style="font-size: 13.3333px;"&gt;SSEtoRServe:&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;IMG __jive_id="182037" alt="clust.PNG" class="jive-image image-1" height="98" src="https://community.qlik.com/legacyfs/online/182526_clust.PNG" style="max-width: 620px; height: 98px; width: 1215.2px;" width="620" /&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;I decided to transplant the problem in R.&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Working on data in R without using the observation as measure (like in Qlik Sense), the result is the same, here my code:&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Iris &amp;lt;- read.csv('&lt;SPAN style="font-size: 13.3333px;"&gt;yourpath&lt;/SPAN&gt;\\Iris.csv',sep=',')&lt;/P&gt;&lt;P&gt;nrow(Iris)&lt;/P&gt;&lt;P&gt;ncol(Iris)&lt;/P&gt;&lt;P&gt;head(Iris)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;clusters &amp;lt;- kmeans((Iris[,2:5]), 3, nstart = 20)$cluster&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;head(Iris[,2:5])&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Iris2 &amp;lt;- cbind(Iris,clusters)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;library(ggplot2)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;p &amp;lt;- ggplot(Iris2, aes(petal.length, petal.width)) &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;p + geom_point(aes(colour = factor(clusters)), size = 3) + geom_text(aes(label=observation),size = 3)&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;IMG __jive_id="182525" alt="clusteR.PNG" class="jive-image image-2" height="373" src="https://community.qlik.com/legacyfs/online/182525_clusteR.PNG" style="height: 372.89px; width: 741px;" width="741" /&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;And that's great!&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;So I tried do create the error that I have, using the species as dimension (I've clean up all the memory etc. in RStudio):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data &amp;lt;- read.table("yourpath\\Iris.csv",sep=",",header=TRUE)&lt;/P&gt;&lt;P&gt;head(data)&lt;/P&gt;&lt;P&gt;data &amp;lt;- data[,2:6]&lt;/P&gt;&lt;P&gt;head(data)&lt;/P&gt;&lt;P&gt;library(plyr)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#&amp;nbsp; grouping&lt;/P&gt;&lt;P&gt;data &amp;lt;- ddply(data,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ~iris.species,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; summarise,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sepal.length = mean(sepal.length),&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sepal.width = mean(sepal.width),&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; petal.length = mean(petal.length),&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; petal.width = mean(petal.width)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# it does not work&lt;/P&gt;&lt;P&gt;kmeans(data,1)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# it works!&lt;/P&gt;&lt;P&gt;kmeans(data[,2:5],1)&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;So R use also the iris species in the kmeans, if you&amp;nbsp; do not remove it explicitly.&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;The question is: how can I make it work with the species as dimension, i.e. a non numeric dimension? I cannot understand why it does not work.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;Thanks in advance.&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;Added the app modded (I modified also de ER, nothing of exagerate).&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;EDIT: Added the app with the aggr()&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 16 Nov 2024 09:05:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Qlik-AAI-Clustering-in-R-kmeans/m-p/1438288#M14436</guid>
      <dc:creator>simotrab</dc:creator>
      <dc:date>2024-11-16T09:05:13Z</dc:date>
    </item>
    <item>
      <title>Re: Qlik AAI: Clustering in R, kmeans</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Qlik-AAI-Clustering-in-R-kmeans/m-p/1438289#M14437</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've done a step further.&lt;/P&gt;&lt;P&gt;Using&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AGGR(R.ScriptEval(&lt;/P&gt;&lt;P&gt;'kmeans(cbind(q$petLen, q$petWid, q$sepLen, q$sepWid), 1, nstart = 20)$cluster',&lt;/P&gt;&lt;P&gt;[petal length] as petLen,&lt;/P&gt;&lt;P&gt;[petal width] as petWid,&lt;/P&gt;&lt;P&gt;[sepal length] as sepLen,&lt;/P&gt;&lt;P&gt;[sepal width] as sepWid&lt;/P&gt;&lt;P&gt;),[iris species])&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;as measure, you can visualize the points but they are not colored, because the error is always the same. Hope it hepls to solve the mystery.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Nov 2017 10:56:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Qlik-AAI-Clustering-in-R-kmeans/m-p/1438289#M14437</guid>
      <dc:creator>simotrab</dc:creator>
      <dc:date>2017-11-10T10:56:14Z</dc:date>
    </item>
    <item>
      <title>Re: Qlik AAI: Clustering in R, kmeans</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Qlik-AAI-Clustering-in-R-kmeans/m-p/1438290#M14438</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Simone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The labeling of the bubbles in your scatter chart is something you control in the R expression. This is an option in the chart-type itself. Look under presentation-&amp;gt; labels&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regard,&lt;/P&gt;&lt;P&gt;Bas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Nov 2017 07:46:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Qlik-AAI-Clustering-in-R-kmeans/m-p/1438290#M14438</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-11-13T07:46:17Z</dc:date>
    </item>
    <item>
      <title>Re: Qlik AAI: Clustering in R, kmeans</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Qlik-AAI-Clustering-in-R-kmeans/m-p/1438291#M14439</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Bas,&lt;/P&gt;&lt;P&gt;sorry, but I've tried to look at&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;presentation -&amp;gt; labels&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but I've not found anything that makes the chart work. Maybe I'm wrong, could you please explain me how can I make it works?&lt;/P&gt;&lt;P&gt;I've added the app with the aggr() mod, hope it helps (if you do not see it, it's because it's under moderation, however in the last chart I've put the formula in the previous comment in place of the original one).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;IMG alt="iris_labels.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/183014_iris_labels.PNG" style="height: 289px; width: 620px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Nov 2017 08:18:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Qlik-AAI-Clustering-in-R-kmeans/m-p/1438291#M14439</guid>
      <dc:creator>simotrab</dc:creator>
      <dc:date>2017-11-14T08:18:45Z</dc:date>
    </item>
  </channel>
</rss>

