Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
igoralcantara
Partner - Contributor III
Partner - Contributor III

Problem with the R Plugin

I have Sense Server November 2017 release. I have installed the R Plugin and I am able to run the R examples provided. So, apparently the plugin is working.

However, when I try to use it with my own data I am not able to make it work.

For example, if I add a text object and write the following expression, I get no result. Not even an error, just a blank text. There are absolutely no blank values.

R.ScriptEval('mean(q$BMI);', BMI)

Issue number 2:

When I try to execute an R command in the script, I get this error "Client specified an invalid argument."

This is the code. The source R file runs fine in R Studio.

TempR:

LOAD '$(vRSource)' As RSource

Autogenerate 1;

R:

NoConcatenate

LOAD

R.ScriptEvalStr('source(q$RSource);', RSource) as R_Output

Resident TempR;

----
datavoyagers.net
Labels (1)
1 Solution

Accepted Solutions
Anonymous
Not applicable

1. As I noticed in all examples when they indicate data they write like this: BMI as bmi. I am  not sure if it matters but if there are no other ideas I would try.

2. For aggregations you need to use aggregate versions of the function:

R.ScriptAggr('mean(q$BMI);' BMI as BMI)

3. You need to be careful when using Str version of the function and passing numerical data. Maybe you could use:

R.ScriptEvalExStr('N', 'source(q$RSource);', RSource as RSource)

View solution in original post

4 Replies
Anonymous
Not applicable

1. As I noticed in all examples when they indicate data they write like this: BMI as bmi. I am  not sure if it matters but if there are no other ideas I would try.

2. For aggregations you need to use aggregate versions of the function:

R.ScriptAggr('mean(q$BMI);' BMI as BMI)

3. You need to be careful when using Str version of the function and passing numerical data. Maybe you could use:

R.ScriptEvalExStr('N', 'source(q$RSource);', RSource as RSource)

Anonymous
Not applicable

For Issue number 2:

Qlik always expect some value to be returned from SSE and actually the source R function does not return anything unless the parameter echo = TRUE.

So the following should work for you:

R.ScriptEvalStr('source(toString(q$RSource[1]), echo = TRUE);', RSource) as R_Output

igoralcantara
Partner - Contributor III
Partner - Contributor III
Author

Is there any documentation for these R.Script functions?

----
datavoyagers.net
Anonymous
Not applicable

Hi Igor!

Yes, the documentation can be found here server-side-extension/writing_a_plugin.md at master · qlik-oss/server-side-extension · GitHub

Regards,

Josefine