Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Oct 29, 2019 6:02:02 PM
Oct 29, 2019 10:28:27 AM
I’ve been working with Qlik for the last four years and in the past few months I’ve been more and more involved into bringing R functionalities into my dashboards. The integration works well but there are clearly some limitations, especially when compared to other solutions on the market; Qlik in my opinion still has a significant edge in terms of performance and associative engine and, when combined with R, it brings unique functionalities and features.
The purpose of this document is to review such limitations and provide solutions with the aim of fully utilising all R capabilities in Qlik Sense; there are Qlik extensions that provide some of these features but, although very well developed and implemented, they are limited to the type of analysis they can perform; also, they require a certain level of technical skills to adapt them to the bespoke needs that very often arise when working with R.
These are the 3 topics I will cover in the document:
I hope you'll find this useful
Please let me know if you have any comment or questions
Lorenzo
Glad you find it useful
Here you can find the instructions on how to integrate R and Qlik Sense:
If you have any issues I suggest you search the forum as there are a few threads about it
Lorenzo
Thanks Lorenzo
Hello, @lorenzoconforti !
I would like to ask whether we can embed plotly (wrapping the plot created by ggplot2 with ggplotly) into Qliksense using this framework.
This is my attempt to adjust a syntax from R_Integration.qvf :
='
<div>
<iframe src="data:text/html;base64,
$(=R.ScriptAggrExStr( 'NNS',
'
#delete any device that might still be active
if (length(dev.list())>0) { for (i in dev.list()[1]:dev.list()[length(dev.list())]) {dev.off()}};
#load libraries
library(tidyr);
library(dplyr);
library(RCurl);
library(ggplot2);
library(plotly);
#create a png temp file; generate plot
tf1 <- tempfile(fileext = ".html");
p<- ggplotly(
ggplot(q, aes(x=petalLength, y=petalWidth, color=species))
+ geom_point()
+ geom_smooth(method="loess")
);
htmlwidgets::saveWidget(as_widget(p), tf1)
dev.off();
txt <- base64Encode(readBin(tf1, "raw", file.info(tf1)[1, "size"]), "txt");
print(txt);
',
[Petal.Width] as petalWidth, [Petal.Length] as petalLength, Species as species
)
)
" height="100%" width="100%"></iframe>
</div>
'
But there is no result shown.
Thanks a lot beforehand!
Best Regards,
Vinz
Hi @cmavp ,
Does this code work in R (I mean, outside of Qlik Sense)? Have you installed the libraries in the Qlik R environment?
I can't troubleshoot it at the moment. Start sink to see what's going on at a console level.
Lorenzo
Hi @lorenzoconforti ,
Yep, the output from ggplotly itself has been successfully generated (as an html file in tmp directory of QS Server, as well as when I tried it in my local PC), so the next steps (which probably become the source of the problem) are to convert to base64 and to embed it to the html template of QS Media Box.
Actually, the conversion to base64 until print(txt) part also has been successfully done, but I'm not sure whether it is the desired output or not.
It is my first time knowing about sink. Do you have any advice on how I should utilize this tool?
Thanks a lot!
Best Regards,
Vinz
sink is an R function that can be used to redirect the output of the console to a txt file so that you can see what is happening
https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/sink
Have a go at this; at least it should clarify what's happening