The cols_width() function

Use select columns from the exibble dataset to create a gt table. We can specify the widths of columns with cols_width(). This is done with named arguments in ..., specifying the exact widths for table columns (using everything() at the end will capture all remaining columns).

exibble |>
  dplyr::select(
    num, char, date,
    datetime, row
  ) |>
  gt() |>
  cols_width(
    num ~ px(150),
    ends_with("r") ~ px(100),
    starts_with("date") ~ px(200),
    everything() ~ px(60)
  )
num char date datetime row
1.111e-01 apricot 2015-01-15 2018-01-01 02:22 row_1
2.222e+00 banana 2015-02-15 2018-02-02 14:33 row_2
3.333e+01 coconut 2015-03-15 2018-03-03 03:44 row_3
4.444e+02 durian 2015-04-15 2018-04-04 15:55 row_4
5.550e+03 NA 2015-05-15 2018-05-05 04:00 row_5
NA fig 2015-06-15 2018-06-06 16:11 row_6
7.770e+05 grapefruit NA 2018-07-07 05:22 row_7
8.880e+06 honeydew 2015-08-15 NA row_8