Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

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

1 Reply
Not applicable
Author

It probably has to do with your security settings. If you go into your macro screen, change on the left hand side the "Current Local Security" to Allow System Access. That should do the trick.