Site icon R-bloggers

Thoughts on Using Flexdashboard

[This article was first published on r on Tony ElHabr, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

I’ve experimented with the {flexdashboard} package for a couple of things after first trying out not so long ago. In particular, I found the storyboard format to be my favorite. I used it to create the storyboard that I wrote about in a previous post about tracking the activity of NBA team Twitter accounts.

I also used {flexdashboard} for a presentation that I gave at my company’s data science group.

Recently, I’ve been experimenting with the storyboard {flexdashboard} format for visualizing the weekly NFL picks that my brother and I do.

The Alternatives

In all, I have found {flexdashboard}s to be an extremely effective format. It functions as a good compromise among a number of different alternatives.

Some Other Opinions

Here’s a couple of my other thoughts and tips for using {flexdashboard}:

For example, I have used the following snippet of code to add functionality for a “toggle” button to show/hide code.

<script>
  $(".toggle").click(function() {
    $(this).toggleClass("open");
  });
</script>

When modifying a theme’s CSS, the typical/recommended approach is to use the browser’s “Inspect” tool (or some browser extension such as Selector Gadget to identify which specific styles to adjust.

For example, if the theme that is chosen for the {flexdashboard} (in particular, the storyboard format) uses the same styling for code and its output, the following CSS code can be used to distinguish the two.

pre.sourceCode.r {
  background-color: #ffffff;
}

To add to this technique, because the CSS files in the {flexdashboard} package, it’s not too difficult to simply pick out the file for the theme that is being used (see the resources/ folder in the package’s GitHub repo) and quickly identify what to modify.

Conclusion

As if I need to re-iterate it again, I would highly recommend trying out the {flexdashboard} package. If anything, you’ll learn that you don’t like it.



  1. These can also be be embedded into .html files knitted from a .Rmdfile, but I think that it’s more natural in the {flexdashboard} context. Also, I believe that the HTML format is the only standard .Rmd output format that has interactive capability, so other output formats cannot be used if opting for the knitr-Rmarkdown combo. ^

To leave a comment for the author, please follow the link and comment on their blog: r on Tony ElHabr.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.