Day 10: reactable

.ReactTable {
  background: #2f3238;
}

Welcome back for the 10th day of the #packagecalendar, today we will be taking a look at a new contender for table creation. I’m talking about the reactable package created by Greg Lin. reactable is a wrapper around the JavaScript library react-table.

The package is available from CRAN and can be downloaded with

install.packages("reactable")

We will be using the elf data from day 7.

You simply pass your data.frame to the reactable() function and it generates a nice looking table.

library(reactable) 

reactable(elf)

reactable is highly customizable with its many arguments in reactable(). Additionally, if you know JavaScript you can raise it to new heights.

There are many more things you can do with this package and I highly encourage you to visit the package website.

Additional Resources

Creating elf dataset

library(tidyverse)
set.seed(1234)

elf <- iris %>%
  rename(Elf = Species,
         `Sugar Consumption` = Sepal.Width,
         `Toy Making Intensity` = Sepal.Length,
         `Jolliness` = Petal.Length,
         `Reindeer Training` = Petal.Width) %>%
  mutate(Elf = factor(as.numeric(Elf), labels = c("Buddy", "Twinkle", "Holly"))) %>%
  mutate_if(is.numeric, jitter)