# NOT RUN {
if (interactive()) {
# Use `exibble` to create a gt table of
# eight rows, replace missing values with
# em dashes; for text in the `time` column,
# we use the Google font 'IBM Plex Mono'
# and set up the `default_fonts()` as
# fallbacks (just in case the webfont is
# not accessible)
tab_1 <-
exibble %>%
dplyr::select(char, time) %>%
gt() %>%
fmt_missing(columns = everything()) %>%
tab_style(
style = cell_text(
font = c(
google_font(name = "IBM Plex Mono"),
default_fonts()
)
),
locations = cells_body(columns = vars(time))
)
# Use `sp500` to create a small gt table,
# using `fmt_currency()` to provide a
# dollar sign for the first row of monetary
# values; then, set a larger font size for
# the table and use the 'Merriweather' font
# using the `google_font()` function (with
# two font fallbacks: 'Cochin' and the
# catchall 'Serif' group)
tab_2 <-
sp500 %>%
dplyr::slice(1:10) %>%
dplyr::select(-volume, -adj_close) %>%
gt() %>%
fmt_currency(
columns = 2:5,
rows = 1,
currency = "USD",
use_seps = FALSE
) %>%
tab_options(table.font.size = px(20)) %>%
opt_table_font(
font = list(
google_font(name = "Merriweather"),
"Cochin", "Serif"
)
)
}
# }
Run the code above in your browser using DataLab