Skip to content

Commit

Permalink
Update examples
Browse files Browse the repository at this point in the history
  • Loading branch information
rich-iannone committed Sep 3, 2024
1 parent dc2a636 commit 90be5f5
Show file tree
Hide file tree
Showing 15 changed files with 114 additions and 56 deletions.
11 changes: 8 additions & 3 deletions R/cols_align.R
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,14 @@
#' ```r
#' countrypops |>
#' dplyr::select(-contains("code")) |>
#' dplyr::filter(country_name == "San Marino") |>
#' dplyr::slice_tail(n = 5) |>
#' gt(rowname_col = "year", groupname_col = "country_name") |>
#' dplyr::filter(
#' country_name == "San Marino",
#' year %in% 2017:2021
#' ) |>
#' gt(
#' rowname_col = "year",
#' groupname_col = "country_name"
#' ) |>
#' cols_align(
#' align = "left",
#' columns = population
Expand Down
18 changes: 12 additions & 6 deletions R/cols_hide.R
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,10 @@
#'
#' ```r
#' countrypops |>
#' dplyr::filter(country_name == "Egypt") |>
#' dplyr::slice_tail(n = 5) |>
#' dplyr::filter(
#' country_name == "Egypt",
#' year %in% 2017:2021
#' ) |>
#' gt() |>
#' cols_hide(columns = c(country_code_2, country_code_3))
#' ```
Expand All @@ -86,8 +88,10 @@
#'
#' ```r
#' countrypops |>
#' dplyr::filter(country_name == "Pakistan") |>
#' dplyr::slice_tail(n = 5) |>
#' dplyr::filter(
#' country_name == "Pakistan",
#' year %in% 2017:2021
#' ) |>
#' gt() |>
#' cols_hide(columns = c(country_code_3, population)) |>
#' tab_footnote(
Expand Down Expand Up @@ -189,8 +193,10 @@ cols_hide <- function(
#' ```r
#' tab_1 <-
#' countrypops |>
#' dplyr::filter(country_name == "Singapore") |>
#' dplyr::slice_tail(n = 5) |>
#' dplyr::filter(
#' country_name == "Singapore",
#' year %in% 2017:2021
#' ) |>
#' gt() |>
#' cols_hide(columns = c(country_code_2, country_code_3))
#'
Expand Down
12 changes: 8 additions & 4 deletions R/cols_label.R
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,10 @@
#' ```r
#' countrypops |>
#' dplyr::select(-contains("code")) |>
#' dplyr::filter(country_name == "Uganda") |>
#' dplyr::slice_tail(n = 5) |>
#' dplyr::filter(
#' country_name == "Uganda",
#' year %in% 2017:2021
#' ) |>
#' gt() |>
#' cols_label(
#' country_name = "Name",
Expand All @@ -164,8 +166,10 @@
#' ```r
#' countrypops |>
#' dplyr::select(-contains("code")) |>
#' dplyr::filter(country_name == "Uganda") |>
#' dplyr::slice_tail(n = 5) |>
#' dplyr::filter(
#' country_name == "Uganda",
#' year %in% 2017:2021
#' ) |>
#' gt() |>
#' cols_label(
#' country_name = md("**Name**"),
Expand Down
30 changes: 20 additions & 10 deletions R/cols_move.R
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,10 @@
#' ```r
#' countrypops |>
#' dplyr::select(-contains("code")) |>
#' dplyr::filter(country_name == "Japan") |>
#' dplyr::slice_tail(n = 10) |>
#' dplyr::filter(
#' country_name == "Japan",
#' year %in% 2012:2021
#' ) |>
#' gt() |>
#' cols_move(
#' columns = population,
Expand Down Expand Up @@ -214,8 +216,10 @@ cols_move <- function(
#' ```r
#' countrypops |>
#' dplyr::select(-contains("code")) |>
#' dplyr::filter(country_name == "Fiji") |>
#' dplyr::slice_tail(n = 5) |>
#' dplyr::filter(
#' country_name == "Fiji",
#' year %in% 2017:2021
#' ) |>
#' gt() |>
#' cols_move_to_start(columns = year)
#' ```
Expand All @@ -231,8 +235,10 @@ cols_move <- function(
#' ```r
#' countrypops |>
#' dplyr::select(-contains("code")) |>
#' dplyr::filter(country_name == "Fiji") |>
#' dplyr::slice_tail(n = 5) |>
#' dplyr::filter(
#' country_name == "Fiji",
#' year %in% 2017:2021
#' ) |>
#' gt() |>
#' cols_move_to_start(columns = c(year, population))
#' ```
Expand Down Expand Up @@ -336,8 +342,10 @@ cols_move_to_start <- function(
#' ```r
#' countrypops |>
#' dplyr::select(-contains("code")) |>
#' dplyr::filter(country_name == "Benin") |>
#' dplyr::slice_tail(n = 5) |>
#' dplyr::filter(
#' country_name == "Benin",
#' year %in% 2017:2021
#' ) |>
#' gt() |>
#' cols_move_to_end(columns = year)
#' ```
Expand All @@ -353,8 +361,10 @@ cols_move_to_start <- function(
#' ```r
#' countrypops |>
#' dplyr::select(-contains("code")) |>
#' dplyr::filter(country_name == "Benin") |>
#' dplyr::slice_tail(n = 5) |>
#' dplyr::filter(
#' country_name == "Benin",
#' year %in% 2017:2021
#' ) |>
#' gt() |>
#' cols_move_to_end(columns = c(year, country_name))
#' ```
Expand Down
12 changes: 8 additions & 4 deletions R/data_color.R
Original file line number Diff line number Diff line change
Expand Up @@ -439,9 +439,11 @@
#'
#' ```r
#' countrypops |>
#' dplyr::filter(country_name == "Bangladesh") |>
#' dplyr::select(-contains("code")) |>
#' dplyr::slice_tail(n = 10) |>
#' dplyr::filter(
#' country_name == "Bangladesh",
#' year %in% 2012:2021
#' ) |>
#' gt() |>
#' data_color(
#' columns = population,
Expand All @@ -464,9 +466,11 @@
#'
#' ```r
#' countrypops |>
#' dplyr::filter(country_name == "Bangladesh") |>
#' dplyr::select(-contains("code")) |>
#' dplyr::slice_tail(n = 10) |>
#' dplyr::filter(
#' country_name == "Bangladesh",
#' year %in% 2012:2021
#' ) |>
#' gt() |>
#' data_color(
#' columns = population,
Expand Down
2 changes: 1 addition & 1 deletion R/format_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -8005,7 +8005,7 @@ get_image_hw_ratio <- function(filepath) {
#' make this work seamlessly, the input cells need to contain some reference to
#' a country, and this can be in the form of a 2- or 3-letter ISO 3166-1 country
#' code (e.g., Egypt has the `"EG"` country code). This function will parse the
#' targeted body cells for those codes (and the [countrypops] dataset contains
#' targeted body cells for those codes (and the [`countrypops`] dataset contains
#' all of them) and insert the appropriate flag graphics.
#'
#' Multiple flags can be included per cell by separating country codes with
Expand Down
11 changes: 8 additions & 3 deletions man/cols_align.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 8 additions & 4 deletions man/cols_hide.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 8 additions & 4 deletions man/cols_label.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions man/cols_move.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 8 additions & 4 deletions man/cols_move_to_end.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 8 additions & 4 deletions man/cols_move_to_start.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions man/cols_unhide.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 8 additions & 4 deletions man/data_color.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/fmt_flag.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 90be5f5

Please sign in to comment.