Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Run Basic .R Script in Qlik Sense

I am trying to run a basic R script that does text mining for the I Have A Dream speech (see attached). I am trying to have Qlik both run the R script and have Qlik pick up the output for visualization (high frequency words). The SSE plugin is installed and although I have successfully test the R.ScriptEval and R.ScriptAggr functions, I am having difficulty testing this more intermediate level use case. Any guidance will be helpful. Thank you.

Labels (2)
4 Replies
Anonymous
Not applicable
Author

Hi, Kwon,

Have you have a look at Brian Bauers post: Qlik AAI Load Script Example - R (Qlik Sense and QlikView)

This may be what you're looking for.

Regards,

Bas.

Not applicable
Author

Hi Bas,

I have studied Brian Bauer's post and have successfully run the Comorbidity app (very helpful). I tried to mimic the script logic using the following script below but encounter an argument error:

SET QvWorkPath='C:\QlikWarehouse\POC Development\Comorbidity\Qlik AAI Load Script Example - R';

SET RSource='$(QvWorkPath)\R\MLKJR.R';

R:

LOAD

*,

R.ScriptEval('starttime <- proc.time(); source(q$RSource); elapsed <- proc.time()-starttime; toString(unname(elapsed["elapsed"]));', RSource) as [Elapsed Time];

LOAD

'$(RSource)' as RSource

Autogenerate 1;

Steven_Pressland
Former Employee
Former Employee

if you want to do this is real time as a chart expression (with changes based upon selection), then to get a different granularity of input data to output data then the best way is to use an AGGR function.

But as per the previous answer, if you just need it as a one time thing against the whole data set, then running in the script is a better option.

Dalton_Ruer
Support
Support

Use the R.ScriptEvalStr function instead since you are exporting the elapsed time as a string. i found this while trying to use a word cloud based on text loaded from other tables and ran into the same problem and get my wordcloud.png generated via this script:

SET RSource='c:\weaknessscript.r';

R:
LOAD *,
R.ScriptEvalStr('starttime <- proc.time(); source(q$RSource); elapsed <- proc.time()-starttime; toString(unname(elapsed["elapsed"]));', RSource) as [Elapsed Time];

LOAD
'$(RSource)' as RSource
Autogenerate 1;