<?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 Use an R function in Script in Integration, Extension &amp; APIs</title>
    <link>https://community.qlik.com/t5/Integration-Extension-APIs/Use-an-R-function-in-Script/m-p/1425520#M14380</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Hi,&lt;/P&gt;&lt;P&gt;It is possible to evaluate&amp;nbsp; a vector with R.Evaluate() while loading data in script. ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let say I have a the Iris dtaset and I want to create a column in script that tells me wich cluster is every record.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Paolo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 16 Nov 2024 09:20:33 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-11-16T09:20:33Z</dc:date>
    <item>
      <title>Use an R function in Script</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Use-an-R-function-in-Script/m-p/1425520#M14380</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Hi,&lt;/P&gt;&lt;P&gt;It is possible to evaluate&amp;nbsp; a vector with R.Evaluate() while loading data in script. ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let say I have a the Iris dtaset and I want to create a column in script that tells me wich cluster is every record.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Paolo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 16 Nov 2024 09:20:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Use-an-R-function-in-Script/m-p/1425520#M14380</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-11-16T09:20:33Z</dc:date>
    </item>
    <item>
      <title>Re: Use an R function in Script</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Use-an-R-function-in-Script/m-p/1425521#M14381</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, that's possible. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Sep 2017 13:44:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Use-an-R-function-in-Script/m-p/1425521#M14381</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2017-09-01T13:44:14Z</dc:date>
    </item>
    <item>
      <title>Re: Use an R function in Script</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Use-an-R-function-in-Script/m-p/1425522#M14382</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Gysbert,&lt;/P&gt;&lt;P&gt;thanks for you're answer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here script I'm using:&lt;/P&gt;&lt;P&gt;[Iris]:&lt;/P&gt;&lt;P&gt;LOAD [observation],&lt;/P&gt;&lt;P&gt;[sepal length],&lt;/P&gt;&lt;P&gt;[sepal width],&lt;/P&gt;&lt;P&gt;[petal length],&lt;/P&gt;&lt;P&gt;[petal width],&lt;/P&gt;&lt;P&gt;[iris species]&lt;/P&gt;&lt;P&gt;FROM [lib://data/Iris.csv]&lt;/P&gt;&lt;P&gt;(txt, codepage is 28591, embedded labels, delimiter is ',', msq);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;rename table Iris to tmp#Iris;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NoConcatenate&lt;/P&gt;&lt;P&gt;Iris:&lt;/P&gt;&lt;P&gt;load&lt;/P&gt;&lt;P&gt;[observation],&lt;/P&gt;&lt;P&gt;[sepal length],&lt;/P&gt;&lt;P&gt;[sepal width],&lt;/P&gt;&lt;P&gt;[petal length],&lt;/P&gt;&lt;P&gt;[petal width],&lt;/P&gt;&lt;P&gt;[iris species],&lt;/P&gt;&lt;P&gt;R.ScriptEval('kmeans(cbind(q$petLen, q$petWid, q$sepLen, q$sepWid), 3, 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) as kclust&lt;/P&gt;&lt;P&gt;resident tmp#Iris;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;drop tabl tmp#Iris;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the error message I receive:&lt;/P&gt;&lt;P&gt;Unexpected token: ',', expected one of: 'AutoGenerate', 'From', 'From_Field', 'Inline', 'Resident', 'Where', 'While', ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a particular syntax to use to use the R.EvaluateScript ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Sep 2017 14:44:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Use-an-R-function-in-Script/m-p/1425522#M14382</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-09-01T14:44:44Z</dc:date>
    </item>
    <item>
      <title>Re: Use an R function in Script</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Use-an-R-function-in-Script/m-p/1425523#M14383</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt;"&gt;I am facing the same problem as Paolo.&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14pt;"&gt;R file, CSV, QVF and Log files are attached.&lt;/SPAN&gt; Hope someone can assist us further.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The script runs OK under R environment:&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_15043005039164823 jive_text_macro" jivemacro_uid="_15043005039164823" modifiedtitle="true"&gt;
&lt;P&gt;rm(list=ls())&lt;/P&gt;
&lt;P&gt;q&amp;lt;-iris&lt;/P&gt;
&lt;P&gt;q[,6]&amp;lt;-kmeans(cbind(q$Petal.Length, q$Petal.Width, q$Sepal.Length, q$Sepal.Width), 3, nstart = 20)$cluster&lt;/P&gt;
&lt;P&gt;q[,6]&lt;/P&gt;
&lt;P&gt;table(q[,6])&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;while after run below in QSE, the error shows "more cluster centers than distinct data points".&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;Tried to remove the header by "names(q) &amp;lt;- NULL", while received the same error message. &lt;/P&gt;&lt;P&gt;Qlik script:&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_15043001042197519 jive_text_macro" jivemacro_uid="_15043001042197519"&gt;
&lt;P&gt;Table1:&lt;/P&gt;
&lt;P&gt;LOAD&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Sepal.Length,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Sepal.Width,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Petal.Length,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Petal.Width,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Species,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; R.ScriptEvalStr('q[,6]&amp;lt;-kmeans(cbind(q$Petal.Length, q$Petal.Width, q$Sepal.Length, q$Sepal.Width), 3, nstart = 20)$cluster;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; q[,6];',&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Sepal.Length,&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Sepal.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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Petal.Length,&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ) as Kmeans&lt;/P&gt;
&lt;P&gt;FROM [lib://Data for Qlik Sense Demo (qvsrv_qlik)/risi.csv]&lt;/P&gt;
&lt;P&gt;(txt, codepage is 28591, embedded labels, delimiter is ',', msq);&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;Qiyu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Sep 2017 21:17:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Use-an-R-function-in-Script/m-p/1425523#M14383</guid>
      <dc:creator>qhe</dc:creator>
      <dc:date>2017-09-01T21:17:38Z</dc:date>
    </item>
    <item>
      <title>Re: Use an R function in Script</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Use-an-R-function-in-Script/m-p/1425524#M14384</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think the problem lies in the fact that during the load script you're only processing one item at a time, while the kmeans clustering needs all data-points in the cluster to determine the clusters. So you call it once for all data points and you get a cluster index for each datapoint.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So you can run the functions in scripts, but not all R functions are suitable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Bas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Sep 2017 10:06:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Use-an-R-function-in-Script/m-p/1425524#M14384</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-09-04T10:06:31Z</dc:date>
    </item>
    <item>
      <title>Re: Use an R function in Script</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Use-an-R-function-in-Script/m-p/1425525#M14385</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;do you have any example of R functions in script?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Paolo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Sep 2017 07:31:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Use-an-R-function-in-Script/m-p/1425525#M14385</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-09-11T07:31:58Z</dc:date>
    </item>
    <item>
      <title>Re: Use an R function in Script</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Use-an-R-function-in-Script/m-p/1425526#M14386</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;To see a working example of the iris dataset, have a look at the Advanced Analytics Expression Builder which will write the code for you. There is a youtube video which uses this dataset as an example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://branch.qlik.com/#!/project/596f87f186a5cf7ec72e90e9" title="http://branch.qlik.com/#!/project/596f87f186a5cf7ec72e90e9"&gt;http://branch.qlik.com/#!/project/596f87f186a5cf7ec72e90e9&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The purpose of this integration for these types of examples is to process in the chart expression, the script usage is limited at present, with an intention for more functionality in the future.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Sep 2017 13:51:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Use-an-R-function-in-Script/m-p/1425526#M14386</guid>
      <dc:creator>Steven_Pressland</dc:creator>
      <dc:date>2017-09-12T13:51:05Z</dc:date>
    </item>
    <item>
      <title>Re: Use an R function in Script</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Use-an-R-function-in-Script/m-p/1425527#M14387</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Steven,&lt;/P&gt;&lt;P&gt;Thanks for you're answer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;my point here is not strinctly bounded to iris dataset. &lt;/P&gt;&lt;P&gt;In order to create real business cases I think that being able to run scripts such as cluster analysis is basically. Usually you want to cluster when you need insights from the data much more complex than iris. &lt;/P&gt;&lt;P&gt;If you have to perform it on a data set with 1000000 record the graph takes a lot, and user loose the Qlik's experience of dynamic navigation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As per my understanding, use R functions ( excluded the sum() ) in the script is not possible, as confirmed also by Qiyu.&lt;/P&gt;&lt;P&gt;If someone has a script, even an easy one, that wants to share it would be very helpful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;Paolo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Sep 2017 07:50:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Use-an-R-function-in-Script/m-p/1425527#M14387</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-09-14T07:50:13Z</dc:date>
    </item>
    <item>
      <title>Re: Use an R function in Script</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Use-an-R-function-in-Script/m-p/1425528#M14388</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-size: 13.3333px;"&gt;I totally agree with Paolo.&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;The examples run live on the &lt;SPAN style="background-color: #f6d5d9;"&gt;data &lt;/SPAN&gt;sent to R.&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;It would be good to be able to run R from script on &lt;SPAN style="background-color: #f6d5d9;"&gt;data sets &lt;/SPAN&gt;also. Clustering is a good example but apriori analysis is an even better one - it takes too long to calculate dynamically.&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;I am also looking for a workaround, lie storing data to CSV and running R or Python in the background (it would load data from that CSV and export results to another CSV - which would be read by Qlik again).&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;An interesting solution can be provided with RapidMiner tool. It can be called from Qlik with simple Web Services request.&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;This way we call it from within the script and receive the result directly into the script. (1. store CSV, 2. call RapidMinder via Web Services, which reads CSV and does the calculation, 3. receive back the result.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Sep 2017 17:15:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Use-an-R-function-in-Script/m-p/1425528#M14388</guid>
      <dc:creator>michal</dc:creator>
      <dc:date>2017-09-14T17:15:34Z</dc:date>
    </item>
  </channel>
</rss>

