So excited to announce the initial release of {gtExtras}, a #rstats 📦 providing "extras for {gt} tables!

🎉🎉🎉

Includes:
💅 4 full themes
🛠️ 12 utility/formatting functions
📊 5 inline plot types
🎨 3 built in color tools

Thread below of functions:

jthomasmock.github.io/gtExtras/
This package is highlighting capabilities that are all _possible_ with {gt} but have repeated boilerplate or wrap multiple function calls internally.

If you haven't updated {gt} recently, make sure to update as gt v0.3 added full support for tidyeval!

gt.rstudio.com/news/index.htm…
With full support for tidyeval in {gt} and in specific functions in {gtExtras}, you can reference columns and rows just as you would in {dplyr}. You also get all the power of things like:

where(is.numeric)
starts_with("name")

dplyr.tidyverse.org/reference/dply…
Fun fact - in about 20 lines of #rstats code you can scrape a table from @FiveThirtyEight , convert the text to a dataframe, and then recreate the _exact_ table with {gt}/{gtExtras}

Code: gist.github.com/jthomasmock/4c…

@friscojosh Data source: fivethirtyeight.com/features/runni… Screenshot of a 538 table, from the article at: https://fiveScreenshot of a reprex recreating a table from the article a
Maybe you're more of a fan of ESPN, the NY Times, or The Guardian? There are themes for those too!

ESPN: jthomasmock.github.io/gtExtras/refer…
NYTimes: jthomasmock.github.io/gtExtras/refer…
Guardian: jthomasmock.github.io/gtExtras/refer… Table styled like ESPN, example code available at: https://jTable styled like The Guardian, code available at: https://jTable styled like the NY Times, code available at: https://j
Maybe you want to have an inline indicator for positive/negatives? We have that too!

With one function call, add in-line "pill" plots indicating wins/losses or positive/negatives! Choose your own palette or use the default.

jthomasmock.github.io/gtExtras/refer… Table of NFL wins and Losses, code available at: https://jth
Ok, so maybe sparklines are more of what you're looking for. Show trends over time and then summary values in the table itself.

jthomasmock.github.io/gtExtras/refer… Table of mtcars data with a sparkline  https://jthomasmock.g
Maybe rather than showing trends, you want to show the percentages of each subgroup.

Check out the gt_plt_bar_stack function! It even includes the ability to dynamically change the column labels with colors and specific text.

jthomasmock.github.io/gtExtras/refer… A table with percent stacked barcharts in place of existing
Beyond just plots, there are other ways to highlight data.

You can quickly highlight specific rows by number or by a logical match.

jthomasmock.github.io/gtExtras/refer… Table with a specific highlighted row, code available at: ht
Want to add some type of unit or symbol to your numbers but still have them align properly? Check out fmt_symbol_first() - has support for specific characters (eg "%") or HTML codes ("%")

jthomasmock.github.io/gtExtras/refer… Table with various units added but maintaining spacing of th
You can use the pad_fn() to pad numeric values so they align at the decimal place but don't require all the trailing zeroes!

jthomasmock.github.io/gtExtras/refer… A table with padded values, ie the trailing zeroes are repla
You can also use gt_text_img() to add an image to the end of your table header. Useful for specifying the group you are working with, or possibly a company logo.

jthomasmock.github.io/gtExtras/refer… Table with the R logo added, code at: https://jthomasmock.gi
The gt_merge_stack() function allows you to merge two existing columns, and stack them for a more compact but rich display.

jthomasmock.github.io/gtExtras/refer… table with merged and stacked values in one column, code at:
Want to know how those inline logos were added? That is gt_image_rows() which allows you to replace inline text representing the image with the actual image!

jthomasmock.github.io/gtExtras/refer… table with inline logos/images, code available at: https://j
There are also helpers for applying max/min functions by group, so you can highlight specific values in a grouped gt table.

jthomasmock.github.io/gtExtras/refer… Table with style applied by group, code available at: https:
Lastly, there are color palette functions - the gt_hulk_col_numeric() functions applies the hulk palette ("purple" and "green") as a heatmap within a column or across the table.

jthomasmock.github.io/gtExtras/refer… Table with "hulk" colors, ie purple and green. Cod
Alternatively, the gt_color_rows() function is a wrapper around {paletteer} and gt::data_color() that lets you quickly apply colors to the table. {paletteer} provides dozens of built-in palettes, and the function supports discrete or continuous values.

jthomasmock.github.io/gtExtras/refer… Table with red color palette, code at: https://jthomasmock.gTable with colorblind friendly discrete color palette, code
More features will be built into the package over time, so give it a try and let me know what type of other features you would like to see for HTML tables!

jthomasmock.github.io/gtExtras/refer…

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Tom Mock

Tom Mock Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @thomas_mock

29 Dec 20
Gotten lots of request for this #rstats blogpost:

"Creating and using custom #ggplot2 themes"

- Theme components/elements
- Building your own theme
- Inspiration from @FiveThirtyEight
- 6 Different examples of using the theme
- Full code to reproduce

themockup.blog/posts/2020-12-…
There are two primary ways I've built #rstats ggplot themes:
- theme() - Add theme components individually, wrap as a function
- %+replace% - Apply an existing theme and overwriting components of it
Inspiration comes from a @FiveThirtyEight article from @tyschalter :

fivethirtyeight.com/features/the-i…

We will "steal like an artist" by getting at the raw data, recreating their example, and build upon some ideas in this article to create a novel plot.
Read 5 tweets
8 Sep 20
1/9

In case you missed it over the long weekend, I put together 45 examples of best practices for building tables in #rstats w/ {gt}!

This includes:
- Example tables (good vs bad)
- Reproducible code for ALL tables
- Links to other resources

themockup.blog/posts/2020-09-…
2/9

@jschwabish put together his "10 Guidelines for tables", which I've adapted to {gt} + #rstats with "good" and "bad" examples.

3/9

Furthermore, Stephen Few indicates WHEN to use a table vs a graph. #RStats Table that says to use tables when you need to look up or co
Read 9 tweets
27 Jul 20
I spent the weekend putting together a "Meta RMarkdown" blog post!

4 R Markdown Strategies:

1 - Literate Programming
2 - Data Product
3 - Control Document
4 - Template

themockup.blog/posts/2020-07-…

#rstats #datascience #tidyverse
1 - Literate Programming

Use RMarkdown like a reproducible scientific notebook, capturing code, comments, and specific outputs in a output document.

All in plain text that is easily human-readable in version control!
2 - Data Product

Generate all sorts of fancy outputs from RMarkdown, such as:
- Presentations (Powerpoint or web native like remark.js)
- Dashboards w/ flexdashboards
- Reports as HTML, PDF, Word, etc
- Entire websites w/ blogdown, hugodown, distill
Read 6 tweets
17 Jan 20
@KTorresStats Hi Katy!

The resume looks good to me!

I'm starting a thread with some ideas.

Goal 1: Connect with #rstats data science community
- Tons of academic and industry here on Twitter
- do informational interviews with acquaintances
- join @RLadiesGlobal Slack @R4DScommunity
@KTorresStats @RLadiesGlobal @R4DScommunity Goal here is to meet someone who can get your name to a hiring manager
- referrals == stronger chance of interview/hire
- R4DS and #rladies Slack are places outside Twitter to find job posts, ask questions, network
- Info interviews help you understand what pro DS do/expect
@KTorresStats @RLadiesGlobal @R4DScommunity Goal #2: read livebook.manning.com/book/build-you…

By @robinson_es and @skyetetra

Tons of good ideas and biggest additional step IMO == get a public portfolio

Essentially show the industry that you can do the job already!
Read 9 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!

Follow Us on Twitter!

:(