R Markdown is a fantastic tool for R users seeking to combine data visualization and analysis in a single reproducible deliverable. However, there are instances in which the volume of figures required clogs up the report, which acts as a nuisance at best and mitigates the impact of the report at worst.

Tabsets solve this problem by seamlessly grouping similar figures and tables into an interactive single instance, which diminishes the amount of clutter in the report without reducing the insights included therein.

Using the Lahman R package to compare statistics across the Major League Baseball (MLB) careers of Mark McGwire and Sammy Sosa, this post will illustrate the problem and then show how to use tabsets to solve it.

## The Problem: Lack of Data Consolidation

Suppose you have a group of figures that you would like to include in your report, and even though they are related, they cannot be combined. Such a collection of figures can take up a lot of real estate in your report, which is often not ideal.

To demonstrate the problem at hand, the three number line graphs below compare the number of home runs, runs batted in, and hits by Mark McGwire and Sammy Sosa across their MLB careers. Notice how much space multiple comparison graphs consume.

## The Solution: Using Tabsets as a Data Center for Consolidation

Tabsets offer a much more compact way of including these figures in a report, allowing the user to consolidate data from multiple worksheets in a single worksheet. Notice below how by clicking through the tabs along the top, all three figures can be viewed while only taking up the space of a single figure. Thus, tabsets can clean up the data visualization throughout a report without reducing the number of figures included.