Creating a Beautiful and Interactive Table using The gt Library in R

A step-by-step guide to creating a beautiful and informative table in R

Irfan Alghani Khalid
8 min readFeb 1, 2023
Photo by Valentino Valkaj on Unsplash

Introduction

Let me show you this table first,

The image is created by the author.

As you can see from above, it’s a data preview from the gapminder data. Specifically, the data displays the population for each country in 2007 and sort it based on that population in descendingly.

The preview itself already generates meaningful insight, but it’s not that aesthetically good. How can we improve this?

Thankfully, the R programming language has a library called gt that helps us build a beautiful and interactive table simultaneously. For a preview, we will create a table like this:

The image is created by the author.

How cool is that?! In this article, I will show you a step-by-step guide on how to create an interactive and beautiful table visualization using the gt library.

--

--