1 Reply Latest reply: Nov 27, 2014 8:08 AM by Neal Bouwman RSS

    Qlik and R integration

      Hi All,

      I am a new user to Qlikview and I was trying to do product association integrating both R and Qlik. While doing this I am facing some statconnector problem ( ActiveX component can't create object: 'StatConnectorSrv.StatConnector' ) and I would like to know how to get the R results in Qlikview in form of a text document. Please help me in resolving this issue

       

      Here is my macro  -

       

       

      Sub runRScore

       

        

           ' Create a COM object representing R

        Set R = CreateObject("StatConnectorSrv.StatConnector")

        R.Init "R"

         

           R.EvaluateNoReturn "library(arules) "

           R.EvaluateNoReturn  "sink('"&CurrentPath&"/output.txt')"

           R.EvaluateNoReturn "product.transaction.set <- read.csv('"&CurrentPath&"/finaldf2.csv', na.strings=c('.', 'NA', '', '?'), strip.white=TRUE, encoding='UTF-8')"   

           R.EvaluateNoReturn "rules <- apriori(product.transaction.set, parameter = list(support = 0.4,conf = 0.6,target = 'rules'))"

           R.EvaluateNoReturn  "rules.sub.services <- subset(rules, subset = lhs %pin% 'AO1')"

           R.EvaluateNoReturn  "inspect(rules.sub.services)"

       

       

         

       

       

        

          ' Close R connection

           R.close

         

           Set v = ActiveDocument.GetVariable("vRuntime")

        'v.SetContent Runtime(), True

         

           ' Load the scores into the QlikView application

           ActiveDocument.DoReload 2, false,false 'Fail on error, Partial Reload

         

           'WriteLog("Retrieved Scores from R at "&Runtime&".")

       

      End Sub