The cols_hide()
function
Use countrypops
to create a gt table. Hide the country_code_2
and country_code_3
columns with cols_hide()
.
countrypops |>
dplyr:: filter (country_name == "Mongolia" ) |>
tail (5 ) |>
gt () |>
cols_hide (columns = c (country_code_2, country_code_3))
country_name
year
population
Mongolia
2017
3096030
Mongolia
2018
3163991
Mongolia
2019
3232430
Mongolia
2020
3294335
Mongolia
2021
3347782
Use countrypops
to create a gt table. Use the population
column to provide the conditional placement of footnotes, then hide that column and one other. Note that the order of the cols_hide()
and tab_footnote()
statements has no effect.
countrypops |>
dplyr:: filter (country_name == "Mongolia" ) |>
tail (5 ) |>
gt () |>
cols_hide (columns = c (country_code_3, population)) |>
tab_footnote (
footnote = "Population above 3,200,000." ,
locations = cells_body (
columns = year,
rows = population > 3200000
)
)
country_name
country_code_2
year
Mongolia
MN
2017
Mongolia
MN
2018
Mongolia
MN
2019
Mongolia
MN
2020
Mongolia
MN
2021