Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Issue while integrating with R

Hi,

I installed StatconnDcom and tested it was running fine in my windows system and also my R was installed successfully.

But when I tried the below simple piece of code it was not creating sss222.csv as it supposed to. I just modified the QlikView-R_Predictive_Demo macro as below , don't know where i made mistake, can someone help me here.... 

' Create a COM object representing R

Set R = CreateObject("StatConnectorSrv.StatConnector")

R.Init "R"

     ' Rattle is Copyright (c) 2006-2012 Togaware Pty Ltd.1

      R.EvaluateNoReturn "library(rattle)"

      R.EvaluateNoReturn "building <- TRUE"

      R.EvaluateNoReturn "setwd(dir = “D:/Lab”)"

      R.EvaluateNoReturn "read.csv(“SalesDemo.csv”)"

  R.EvaluateNoReturn "sasken <- Read.csv(“SalesDemo.csv”)"

      R.EvaluateNoReturn "write.csv(sasken, file='"&CurrentPath&"/sas222.csv')"

      R.EvaluateNoReturn "basken <- lm(formula = AdvCost ~ Sales, data =sasken)"         

     'R.EvaluateNoReturn "write.csv(cbind(sdata, crs$pr),

      'file='"&CurrentPath&"/results/ExportFile_score_idents.csv', row.names=FALSE)"

      R.EvaluateNoReturn "write.csv(basken, file='"&CurrentPath&"/sasken.csv', row.names=FALSE)"

     ' 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 

   

End Sub

2 Replies
agigliotti
Partner - Champion
Partner - Champion

Hello,

What version of R are you using ?

Because after I upgraded to version 3.0.1 from version 2.xx the COM object doesn't works anymore !

Please let me know.

Thanks & Regards

Andrea

agigliotti
Partner - Champion
Partner - Champion

Hello,

I solved the issue using the latest version of R 3.0.2

Best regards

Andrea