- 3 Minutes Wednesdays
- Posts
- 3MW (Dashboards with Shiny)
3MW (Dashboards with Shiny)
Guten Tag!
Many greetings from Ulm, Germany.
As promised, I published the first draft of my {gt} book last week. You can read it online. Lucky for me, the table contest's deadline was moved by two weeks. So I still have some time to add stuff or correct typos. If you have any special wishes for what I should add, let me know and I'll see what I can do.
Focusing on tables was fun for a couple of weeks. But now I'm moving on to my next big project. This one will be based on dashboards with {shiny}. More specifically, we'll shift our focus to {bs4Dash}. If you're not that familiar with {shiny} yet, I have some resources for you at the end.
Getting to know {bs4Dash}
For me, getting acquainted with {bs4Dash} was a bit hard. You will soon know why. To get a feeling what this package has to offer, you can run bs4DashGallery(). This will start the HUGE demo app:
That's a lot, right? Now you understand why this package can be overwhelming. So let's take it one step at a time. Let's talk UI structure. Once you understand it, it's not so hard to start your first {bs4Dash} app.
In this image, each of the areas corresponds to one aspect of your dashboard. Why am I showing you this? Because the R command that creates the dashboard's UI is structured exactly the same.
As you can see, each area comes with its own UI function. These are pretty well-documented. But we'll talk more about them in the upcoming weeks.
Toggle all the things
Many {bs4dash} elements come with a toggle feature. Thus, you can fold/unfold many UI elements by default. This may not sound like a big thing but I love it. The smooth transition from unfolded to folded status (and vice versa) just feels like an incredibly interactive thing. (note that the gifs below are much laggier compared to the real smoothness in an app).
And it is not just a great feature for aesthetic reasons. This feature allows you to save some space by folding unimportant things. For example, the sidebar of even the most basic {bs4dash} app is foldable.
Sort boxes
Another great feature comes via the box() and sortable() functions. The former function creates a box on the UI that you can fill with whatever you like. Wrapping multiple boxes into sortable() makes the boxes rearrangeable interactively. How cool is that?
Recommended Resources
Need help catching up to the {shiny} stuff? Here are some resources.
Introduction to Shiny: This is a book chapter that I wrote a while back when I taught an intro to data science with R course at my university. It should get you up and running with the basics of {shiny}.
6 simple Shiny things: You can think of this as a follow-up to the previous book chapter.
Interactive plots and user feedback: Another blog post about making ggplots interactive with {shiny} and adding warning and success messages to any app.
That's a wrap! As always, I'm happy to hear your feedback about this week's issue. Feel free to write me on Twitter or reply to this mail.
Enjoy the rest of your day!Albert
Did you like this post and want to support more content like this? Whenever you feel like it, you can support me with a coffee or a membership.
Need help visualizing your data? Or need to build a Shiny app? I'm open to freelance work. You can book a free 30-minute Zoom meeting with me and we can find out if I'm a good match for your project.
Reply