Additional Table Libraries to Support The GT Library in R Programming

gtsummary and gtExtra are a small family of libraries that can augment the gt library and enhance your data tables

Pierre DeBois
CodeX

--

I had mentioned in another post how the gt library has a few functions like nanoplots to fit visuals within each row of your table. There are gt extensions that can also enhance your datatable. While not as extensive as the tidyverse, these libraries offer additional options that makes your data tables pop.

gtExtra

One of which is gtExtra(). This combines the best of graphics and tables in one visualization that fits a formatted HTML page or an image to be imported into a Word doc.

For example, here is a table displaying the mean and standard deviation of the city mpg of the gtcars dataset. The vehicles are grouped by body style. The function gt_plt_dist() from the gtExtra library can display a distribution curve of your data using an existing gt_tbl object and adds summary distribution sparklines via ggplot2.

So for this example we are taking the dataset in car_summary, arranging the data according to body style, then applying the gt() to change it into a gt object, and the using the gt_plt_dist() function to display the standard…

--

--

Pierre DeBois
CodeX
Writer for

#analytics |#datascience |#JS |#rstats |#marketing services for #smallbiz | #retail | #nonprofits Contrib @CMSWire @smallbiztrends #blackbusiness #BLM