Learn R Programming

tabulate

Tabulate is a thin wrapper around the tabulate C++ library. It allows users to pretty print tables in the console, with support for different font styles, colors, borders and etc. It also supports multi-bytes characters and nesting tables.

Installation

tabulate can be installed from CRAN with:

install.packages("tabulate")

You can install the development version of tabulate from GitHub with:

# install.packages("remotes")
remotes::install_github("mlverse/tabulate")

Example

The following example shows basic functionality of tabulate. Like formatting and coloring the output. Note that color and font styles are only suppported in platforms that support ANSI strings. For a colored version of this table see this link.

library(tabulate)
department <- tabulate_table() %>% 
  table_add_row(c("Research", "Engineering"))

employees <- tabulate_table() %>% 
  table_add_row(
    c("Emp. ID", "First Name", "Last Name", "Department / Business Unit")) %>% 
  table_add_row(c("101", "Donald", "Patrick", "Finance")) %>% 
  table_add_row(
    c("102", "Rachel", "Williams", 
      "Marketing and Operational\nLogistics Planning")) %>% 
  table_add_row(c("103", "Ian", "Jacob", department))

employees[,1] %>% 
  format_font_style("bold") %>% 
  format_font_color("red") %>% 
  format_font_align("right")

employees[,4] %>% format_font_align("center") 
print(employees)

See the example gallery for more.

Copy Link

Version

Install

install.packages('tabulate')

Monthly Downloads

55

Version

0.1.0

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Daniel Falbel

Last Published

February 16th, 2022

Functions in tabulate (0.1.0)

tabulate_table

Create a new tabulate table
%>%

Pipe operator
tabulate_demo

Generated demonstration tables
formatting

Formatting of tables, columns, rows and cells