Structure

Starting a GT Table

Working with the Header

We use tab_header() to modify the header of our table. We can supply both a title and subtitle for our Table.

Here we’re using the pipe |> to chain our commands together.

Here we chain commands together using . - we usually use this in Python to select methods.

Selecting Columns

How do we specify columns to modify? We can use column selectors (in Great Tables in Python) or tidy selectors in R.

Much more info about column selectors in Python: https://posit-dev.github.io/great-tables/get-started/column-selection.html

Column Spanners

We can specify a spanner with tab_spanner(), which takes two main arguments:

  • label - what we want the spanner to say
  • columns - which columns we want to apply the spanner to.

Column Labels

Change Column labels for readability. The column names are: product, revenue_dollars, revenue_pct, profit_dollars, profit_pct, and monthly_sales.

Formatting the Stub

I have to use a separate table to show these. We have two columns in this dataset: row, which serve as the row labels, and group, which serve as the column labels.

We can make the group its own column with row_group_as_column = TRUE. This does not appear to be the case in Python, however:

```