Preview a gt table objectSource:
Sometimes you may want to see just a small portion of your input data. We can
gt_preview() in place of
gt() to get the first x rows of data and the
last y rows of data (which can be set by the
arguments). It's not advised to use additional gt functions to further
modify the output of
gt_preview(). Furthermore, you cannot pass a gt
data.frameobject or a tibble.
This value will be used as the number of rows from the top of the table to display. The default,
5, will show the first five rows of the table.
The value will be used as the number of rows from the bottom of the table to display. The default,
1, will show the final row of the table.
An option to include the row numbers for
datain the table stub. By default, this is
Any grouped data or magic columns such as
groupname will be
gt_preview() and, as such, one cannot add a stub or group rows
in the output table. By default, the output table will include row numbers in
a stub (including a range of row numbers for the omitted rows). This row
numbering option can be deactivated by setting
gtcars to create a gt table preview (with only a few of its
columns). You'll see the first five rows and the last row.
gtcars %>% dplyr::select(mfr, model, year) %>% gt_preview()
Other table creation functions: