The gt_split() function

Use a subset of the gtcars dataset to create a gt table. Format the msrp column to display numbers as currency values, set column widths with cols_width(), and split the table at every five rows with gt_split(). This creates a gt_group object containing two tables. Printing this object yields two tables separated by a line break.

gtcars |>
  dplyr::slice_head(n = 10) |>
  dplyr::select(mfr, model, year, msrp) |>
  gt() |>
  fmt_currency(columns = msrp) |>
  cols_width(
    year ~ px(80),
    everything() ~ px(150)
  ) |>
  gt_split(row_every_n = 5)
mfr model year msrp
Ford GT 2017 $447,000.00
Ferrari 458 Speciale 2015 $291,744.00
Ferrari 458 Spider 2015 $263,553.00
Ferrari 458 Italia 2014 $233,509.00
Ferrari 488 GTB 2016 $245,400.00
mfr model year msrp
Ferrari California 2015 $198,973.00
Ferrari GTC4Lusso 2017 $298,000.00
Ferrari FF 2015 $295,000.00
Ferrari F12Berlinetta 2015 $319,995.00
Ferrari LaFerrari 2015 $1,416,362.00

Use a smaller subset of the gtcars dataset to create a gt table. Format the msrp column to display numbers as currency values, set the table width with tab_options() and split the table at the model column This creates a gt_group object again containing two tables but this time we get a vertical split. Printing this object yields two tables of the same width.

gtcars |>
  dplyr::slice_head(n = 5) |>
  dplyr::select(mfr, model, year, msrp) |>
  gt() |>
  fmt_currency(columns = msrp) |>
  tab_options(table.width = px(400)) |>
  gt_split(col_slice_at = "model")
mfr model
Ford GT
Ferrari 458 Speciale
Ferrari 458 Spider
Ferrari 458 Italia
Ferrari 488 GTB
year msrp
2017 $447,000.00
2015 $291,744.00
2015 $263,553.00
2014 $233,509.00
2016 $245,400.00