Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I've got R integration set up with Qlik Sense Desktop and all seems to be working okay. The example QVFs work fine and I have been able to send in two arguments and multiply them.
Unfortunately, I don't have any prior experience of using R.
Can anyone please advise how I can go about drawing a straight line through a set of values on a line chart?
Further to that, can someone advise how to extend that line n dimension values into future?
Thanks in advance.
Steve
Just found someone that knows a bit of R in the building, have come up with this:
R.ScriptEval('lm(.arg2~.arg1)$fitted.values',Dim,Value)
And this:
R.ScriptEval('
a=.arg1
b=.arg2
lm1=lm(b~a)
predict(lm1,data.frame(a=seq(1,200,1)))
',Dim,Value)
Both seem to work well.
Just found someone that knows a bit of R in the building, have come up with this:
R.ScriptEval('lm(.arg2~.arg1)$fitted.values',Dim,Value)
And this:
R.ScriptEval('
a=.arg1
b=.arg2
lm1=lm(b~a)
predict(lm1,data.frame(a=seq(1,200,1)))
',Dim,Value)
Both seem to work well.
What extension are you using that gives you the ability to evaluate R scripts from QS?
It's beta functionality, which is in the product already but is not publicly documented. You also need to install a plug in which is not yet publicly available.
Hopefully it will be ready for prime-time soon, and I will try to remember to post back to this thread when it is.
Steve
Please do.
Thanks for posting this Steve - very helpful for jumpstarting the process.
Martin
Hi Steve,
Do you have any idea to calculate R² (R.squared)
Thanks!
Hi Yves, What is R in this context? Is it a field? If so it is just R*R. If you are aggregating you will need a sum around it, e.g. sum(R*R).
Sorry if I have missed the point?
Hi Steve,
R² ist a coefficient(variance) of regression in statistic,
you can use for it the function Linest_R2 in Qlik and in R: summary(lm(a~b))$r.squared. I tried to calculate this measure in a KPI-Chart with R but i didn't get it
I thought I was probably missing something - should have taken the time to Google, it's been one of those days though.
Have you got any output from R coming into your app? Does the simple straight line work for you?