The cols_unhide()
function
Use countrypops
to create a gt table. Hide the country_code_2
and country_code_3
columns with cols_hide()
.
tab_1 <-
countrypops |>
dplyr:: filter (country_name == "Mongolia" ) |>
tail (5 ) |>
gt () |>
cols_hide (columns = c (country_code_2, country_code_3))
tab_1
country_name
year
population
Mongolia
2017
3096030
Mongolia
2018
3163991
Mongolia
2019
3232430
Mongolia
2020
3294335
Mongolia
2021
3347782
If the tab_1
object is provided without the code or source data to regenerate it, and, the user wants to reveal otherwise hidden columns then the cols_unhide()
function becomes useful.
tab_1 |> cols_unhide (columns = country_code_2)
country_name
country_code_2
year
population
Mongolia
MN
2017
3096030
Mongolia
MN
2018
3163991
Mongolia
MN
2019
3232430
Mongolia
MN
2020
3294335
Mongolia
MN
2021
3347782