Skip to content

Improve the stub so that it can be formatted#1038

Merged
cscheid merged 23 commits intomasterfrom
power-stub
Sep 6, 2022
Merged

Improve the stub so that it can be formatted#1038
cscheid merged 23 commits intomasterfrom
power-stub

Conversation

@rich-iannone
Copy link
Member

@rich-iannone rich-iannone commented Sep 3, 2022

These changes make it possible to format the stub with fmt_*() functions. This also adds the stub() select helper function.

The following code uses the stub() helper in a few functions. Notably, fmt_markdown() now performs Markdown translation in a stub column, cols_align() now works on the stub column, and the width of the stub column is now easier to control with stub() on the LHS of ~.

library(gt)

dplyr::tibble(
  stub = c("*one*", "**two**", "three"),
  vals = 3:1
) %>%
  gt(rowname_col = "stub") %>%
  fmt_markdown(columns = stub()) %>%
  cols_align(
    align = "center",
    columns = everything()
  ) %>%
  cols_width(
    stub() ~ px(500),
    everything() ~ px(200)
  )

power-stub

Fixes: #747

@rich-iannone rich-iannone marked this pull request as ready for review September 6, 2022 03:35
@rich-iannone rich-iannone requested a review from cscheid September 6, 2022 14:41
Copy link
Member

@cscheid cscheid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@cscheid cscheid merged commit 1bf93cd into master Sep 6, 2022
@rich-iannone rich-iannone deleted the power-stub branch September 6, 2022 15:01
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.

Introduce the stub() helper function to target the stub (for cols_width() and other targeting fns)

2 participants