Skip to content

Introduce the from_column() helper function and implement its use in tab_stub_indent() #1392

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Aug 3, 2023

Conversation

rich-iannone
Copy link
Member

This PR introduces the from_column() helper function, which is meant to help define a set of values for a compatible parameter (argument). In this first part of the work, the helper is defined with some basic arguments of its own; the first working implementation of it is with the tab_stub_indent() function.

Here is an example of how it works in practice, where we get row-by-row values for the indent parameter from the rank column.

exibble |>
  dplyr::select(char, fctr, currency) |>
  dplyr::mutate(rank = dense_rank(desc(currency))) |>
  dplyr::arrange(rank) |>
  gt(rowname_col = "char") |>
  tab_stub_indent(
    rows = everything(),
    indent = from_column(column = "rank", na_value = 3, fn = NULL)
  )
tab_stub_indent_with_column

Notice that the row labels in the stub are indented according to the values in the rank column.

@netlify
Copy link

netlify bot commented Aug 2, 2023

Deploy Preview for quarto-gt-examples failed.

Name Link
🔨 Latest commit b4d5303
🔍 Latest deploy log https://app.netlify.com/sites/quarto-gt-examples/deploys/64cc19953751f90008de552e

@rich-iannone rich-iannone marked this pull request as ready for review August 3, 2023 23:27
@rich-iannone rich-iannone merged commit 06e9665 into master Aug 3, 2023
@rich-iannone rich-iannone deleted the tab-stub-indent-from-column branch August 3, 2023 23:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant