Introducing gt_summarytools: Analyze Your Data Faster With R

Written by Matt Dancho



Hey guys, welcome back to my R-tips newsletter. In today’s fast-paced data science environment, speeding up exploratory data analysis (EDA) is more critical than ever. This is where gt_summarytools() comes in. A new function I’ve developed, gt_summarytools(), combines the best features of gt and summarytools, allowing you to create detailed, interactive data summaries faster and with more flexibility than ever. Let’s go!

Table of Contents

Here’s what you’re learning today:

  • Why Quick Data Analysis Matters

  • Introducing gt_summarytools():
    • Combining the Best of gt and summarytools
    • Creating Summaries with gt_summarytools()
  • Get the Code: Join the R-Tips Newsletter to get the code and stay updated.

Analyze Your Data Faster with gt_summarytools()

Get the Code (In the R-Tip 085 Folder)


SPECIAL ANNOUNCEMENT: ChatGPT for Data Scientists Workshop on October 23rd

Inside the workshop I’ll share how I built a Machine Learning Powered Production Shiny App with ChatGPT (extends this data analysis to an insane production app):

ChatGPT for Data Scientists

What: ChatGPT for Data Scientists

When: Wednesday October 23rd, 2pm EST

How It Will Help You: Whether you are new to data science or are an expert, ChatGPT is changing the game. There’s a ton of hype. But how can ChatGPT actually help you become a better data scientist and help you stand out in your career? I’ll show you inside my free chatgpt for data scientists workshop.

Price: Does Free sound good?

How To Join: 👉 Register Here


R-Tips Weekly

This article is part of R-Tips Weekly, a weekly video tutorial that shows you step-by-step how to do common R coding tasks. Pretty cool, right?

Here are the links to get set up. 👇

This Tutorial is Available in Video (9-minutes)

I have a 9-minute video that walks you through setting up gt_summarytools() in R and running your first exploratory data analysis with it. 👇

Why Quick Data Analysis Matters

Exploratory Data Analysis is crucial for understanding your data, spotting trends, and detecting issues before diving into more advanced modeling techniques. But EDA can often be a time-consuming task if you’re not using the right tools.

That’s why I developed gt_summarytools() — to provide a faster, more efficient way to analyze your data using the power of gt and summarytools.

Introducing gt_summarytools()

If you’ve used summarytools for generating quick summaries and gt for creating visually appealing tables, you’ll love this new function. gt_summarytools() combines the two, allowing you to get the best of both worlds: concise, visually-rich summaries that are easy to generate and interpret.

Here’s one of the summaries we will create today with gt_summarytools():

GT summarytools

Combining the Best of gt and summarytools

Here’s how it works:

  • gt: A package for creating publication-quality tables.

  • summarytools: Known for its powerful dfSummary() function that provides a detailed overview of your data frame.

  • gt_summarytools(): The perfect combination of the two, giving you a beautiful summary table with just a few lines of code.

Let’s dive into a demo!

Code Demo: gt_summarytools() in Action

I’ve developed this function to help you summarize your data faster and with more visual appeal. Let’s take a look at the new code demo, exclusively for R-tips newsletter subscribers.

Get the Code

Get the Code (In the R-Tip 085 Folder)

Step 1: Load Libraries and Data

Run this code to load the libraries and data:

Libraries and Data

Step 2: Load the source code for gt_summarytools()

Next, source the code for the gt_summarytools() function (it’s in the R-Tip 085 Folder).

Run this code:

Source the gt_summarytools_code

Get the Code (In the R-Tip 085 Folder)

Step 3: Run gt_summarytools() on the datasets provided

We can generate quick summaries using gt_summarytools(). Run this code:

Running gt_summarytools

Get the Code (In the R-Tip 085 Folder)

Here, we’re using the gt_summarytools() function to generate a beautiful table summarizing the churn data and stock data. These tables are not only functional but visually appealing, thanks to the gt_theme_538() theme, which adds a clean, professional style.

Let’s examine the output:

Customer Churn Summary:

Customer Churn Summary

Stock Data Summary:

Stock Data Summary

Want the Full Code?

To get access to the full source code for gt_summarytools(), subscribe to the R-Tips Newsletter. This code is available exclusively to subscribers!

Source Code

Get the Code (In the R-Tip 085 Folder)

Conclusion: Save Time and Analyze Faster

By leveraging gt_summarytools(), you can significantly speed up your data analysis workflow, all while generating better-looking tables. This function simplifies the process of data exploration, making it easier to gain insights and focus on decision-making and modeling.

But there’s more to becoming a data scientist.

If you would like to grow your Business Data Science skills with R, then please read on…

Need to advance your business data science skills?

I’ve helped 6,107+ students learn data science for business from an elite business consultant’s perspective.

I’ve worked with Fortune 500 companies like S&P Global, Apple, MRM McCann, and more.

And I built a training program that gets my students life-changing data science careers (don’t believe me? see my testimonials here):

6-Figure Data Science Job at CVS Health ($125K)
Senior VP Of Analytics At JP Morgan ($200K)
50%+ Raises & Promotions ($150K)
Lead Data Scientist at Northwestern Mutual ($175K)
2X-ed Salary (From $60K to $120K)
2 Competing ML Job Offers ($150K)
Promotion to Lead Data Scientist ($175K)
Data Scientist Job at Verizon ($125K+)
Data Scientist Job at CitiBank ($100K + Bonus)

Whenever you are ready, here’s the system they are taking:

Here’s the system that has gotten aspiring data scientists, career transitioners, and life long learners data science jobs and promotions…

What They're Doing - 5 Course R-Track

Join My 5-Course R-Track Program Now!
(And Become The Data Scientist You Were Meant To Be...)

P.S. - Samantha landed her NEW Data Science R Developer job at CVS Health (Fortune 500). This could be you.

Success Samantha Got The Job