Qlik Community

Qlik Server Side Extensions Discussions

Discussion Board for collaboration on Server-Side Extensions and Advanced Analytics Integration.

m-vineis
New Contributor

Unable to use computed value from R as Dimension

Problem: I am unable to use a value computed in R as a dimension in a plot.

Background: I am trying to create a histogram of the residuals from a simple linear regression, similar to this plot:

In order to obtain the residuals, I am using the following expression:

R.ScriptEval('lm(q$medv ~ q$lstat)$residuals', medv, lstat)

Note that both the inputs and the output from R are numeric variables. I used the same script as a Measure expression in a scatterplot and it worked as expected. However, when I attempt to use the script to create a dimension in a histogram or a bar chart, I receive an 'Internal engine error'.

Question: Is there something about the way dimensions are used that would prevent me from using a numeric vector returned from R?

1 Solution

Accepted Solutions
bvk
Contributor II

Re: Unable to use computed value from R as Dimension

Hi Michael,

Yes, this is a known limitation of the current implementation. AAI is not supported for calculated dimensions, or at least it can give unpredictable results. The only possible workaround would be to build the dimensions in the load script.

Regards,

Bas van Reeuwijk

1 Reply
bvk
Contributor II

Re: Unable to use computed value from R as Dimension

Hi Michael,

Yes, this is a known limitation of the current implementation. AAI is not supported for calculated dimensions, or at least it can give unpredictable results. The only possible workaround would be to build the dimensions in the load script.

Regards,

Bas van Reeuwijk

Community Browser