Todays blog post is more a note than a full blog post.
On my previous post, opencpu was used to create a back-end environment for a flexdashboard dashboard.
On that post, I use a bit of js to include dynamic plot into my web page.
Set up
It is possible to include js directly in your .rmd. I prefer for small piece of code to use htmltools
but it is not mandatory:
Plot
Now, we use the .rplot
function to call plot. here, with a parameter of 1.
It is indeed useless if the plot is not a dynamic one. It is better in that case to include a fixed image.
The code used to include this post:
Dynamic plot
With a bit of js, we can easily complexify the process to make it reactive:
And the interface:
The result is a dynamic plot inside the blog post.
You can enter any integer between 1 and 544:
The same can be done to create dynamic json or any htmlwidget output.
Leave a Comment