The cols_hide() method allows us to hide one or more columns from appearing in the final output table. While it’s possible and often desirable to omit columns from the input table data before introduction to the GT() class, there can be cases where the data in certain columns is useful (as a column reference during formatting of other columns) but the final display of those columns is not necessary.
Parameters
Name
Type
Description
Default
columns
SelectExpr
The columns to hide in the output display table. Can either be a single column name or a series of column names provided in a list.
The hiding of columns is internally a rendering directive, so, all columns that are ‘hidden’ are still accessible and useful in any expression provided to a rows argument. Furthermore, the cols_hide() method (as with many of the methods available in Great Tables) can be placed anywhere in a chain of calls (acting as a promise to hide columns when the timing is right). However there’s perhaps greater readability when placing this call closer to the end of such a chain. The cols_hide() method quietly changes the visible state of a column and doesn’t yield warnings when changing the state of already-invisible columns.