Routing has been around in web frameworks for a while. Since this was something we were missing in Shiny so much we developed this package to simplify our development.
Firstly, it’s possible to share a link like http://your-app-url/stats/dashboard and redirect a user to the specific state in app.
For instance, in our demo you can directly go to other page with http://demo.appsilon.com/shiny.router/#!/other.
Secondly, it’s easier to write a clean code by separating UI into meaningful code blocks.
How do you integrate it?
First make sure you have shiny.router dependency installed. This package is not yet available on CRAN, so you have to install it with devtools:
First you have to define a routing.
This will create 2 reactive links:
http://your-app-url redirecting to Root page and
http://your-app-url/other redirecting to Other page in your app.
First passed argument is also a default redirection for all invalid links(“/” in this case). You can also specify it explicitly via “default” argument.
Next, make sure you bind and run your “router” object properly in your Shiny app source code.
Now it’s time for a live demo. Try clicking “Page” and “Other” menu links:
Here’s the complete code, if you want to try it out by yourself:
You might be wondering how we managed to make this nice looking demo. This is a small preview of our next package using SemanticUI. You may find it already on our Github, but there is hardly any documentation at the moment.
Side Note!You will have to install it to run a second repo example.
Please stay tuned for our next blog post.
Reach out to Appsilon
If you want to find out what we can do for your industry please leave us a message and we will reach out to you.
shiny.router – a simple routing package for Shiny Dashboards