Skip to content
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

Include option to hide all column labels #237

Merged
merged 6 commits into from
Apr 8, 2019
Merged

Conversation

rich-iannone
Copy link
Member

Sometimes it can be very useful not to have column labels at all. This PR makes that possible by providing the column_labels.hide argument in tab_options(). Here is a working example:

# Create a few Markdown-based
# text snippets
text_1a <- "
 ### This is Markdown.

 Markdown’s syntax is comprised entirely of
 punctuation characters, which punctuation
 characters have been carefully chosen so as
 to look like what they mean... assuming
 you’ve ever used email.
 "

text_1b <- "
 Info on Markdown syntax can be found
 [here](https://daringfireball.net/projects/markdown/).
 "

text_1c <- "<img src=\"https://i.imgur.com/3RqWtfL.gif\" width=\"200\">"

text_2a <- "
 The **gt** package has these datasets:

  - `countrypops`
  - `sza`
  - `gtcars`
  - `sp500`
  - `pizzaplace`
  - `exibble`
 "

text_2b <- "
 There's a quick reference [here](https://commonmark.org/help/).
 "

text_2c <- "
 Yes, gifs should work.
 "

# Arrange the text snippets as a tibble
# using the `dplyr::tribble()` function;
# then, create a gt table and format
# all columns with `fmt_markdown()`
dplyr::tribble(
  ~Markdown, ~md,
  text_1a,   text_2a,
  text_1b,   text_2b,
  text_1c,   text_2c,
) %>%
  gt() %>%
  fmt_markdown(columns = TRUE) %>%
  tab_options(
    table.width = px(500),
    column_labels.hide = TRUE
  )

no_column_labels

Closes #225.

@rich-iannone rich-iannone requested a review from jcheng5 April 1, 2019 20:40
Copy link
Member

@jcheng5 jcheng5 left a comment

Choose a reason for hiding this comment

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

Missing tests... other than that, LGTM. Don't forget to cardify and send through QA.

@rich-iannone rich-iannone requested a review from jcheng5 April 8, 2019 05:39
@rich-iannone rich-iannone merged commit 49df7fb into master Apr 8, 2019
@rich-iannone rich-iannone deleted the column-labels-hidden branch April 8, 2019 05:45
rich-iannone added a commit that referenced this pull request Apr 8, 2019
* master:
  Include option to hide all column labels (#237)
rich-iannone added a commit that referenced this pull request Apr 11, 2019
* master:
  Include option to hide all column labels (#237)
rich-iannone added a commit that referenced this pull request Apr 21, 2019
* master:
  Include option to hide all column labels (#237)
rich-iannone added a commit that referenced this pull request Apr 27, 2019
* master: (37 commits)
  Use webshot to generate images of HTML tables (#257)
  Rewritten vignette for adding summary rows (#273)
  Move roxygen documentation to Markdown (#253)
  Store empty-string value in `sep` vector (#274)
  Bugfixes and improvements to `summary_rows()` (#175)
  Modify _travis.yml (#263)
  Make several refactoring improvements to some `format_*()` functions (#244)
  Include option to hide all column labels (#237)
  Refactoring of formatter functions (#232)
  Improvement to the handling of a `pattern` in most `fmt*()` functions (#95)
  pkgdown cleanup (#226)
  Make argument names in `tab_options()` more consistent with terminology (#221)
  dplyr::data_frame deprecated (#195)
  Remove a unicode character from roxygen documentation (#220)
  Try again, this time with `travis encrypt --com`
  Trying again with github token (#223)
  Use jcheng5 GitHub PAT instead of rich-iannone (#222)
  Update README (#219)
  Fix for `fmt_date()` that allows `Date` columns to work (#203)
  Remove check on macOS
  ...
rich-iannone added a commit that referenced this pull request Apr 27, 2019
* master:
  Use webshot to generate images of HTML tables (#257)
  Rewritten vignette for adding summary rows (#273)
  Move roxygen documentation to Markdown (#253)
  Store empty-string value in `sep` vector (#274)
  Bugfixes and improvements to `summary_rows()` (#175)
  Modify _travis.yml (#263)
  Make several refactoring improvements to some `format_*()` functions (#244)
  Include option to hide all column labels (#237)
rich-iannone added a commit that referenced this pull request May 8, 2019
* master:
  Adding the `currency()` helper function for specifying custom currencies (#281)
  Enable table striping options (#236)
  Path expand all file inputs (#278)
  Use webshot to generate images of HTML tables (#257)
  Rewritten vignette for adding summary rows (#273)
  Move roxygen documentation to Markdown (#253)
  Store empty-string value in `sep` vector (#274)
  Bugfixes and improvements to `summary_rows()` (#175)
  Modify _travis.yml (#263)
  Make several refactoring improvements to some `format_*()` functions (#244)
  Include option to hide all column labels (#237)
  Refactoring of formatter functions (#232)
  Improvement to the handling of a `pattern` in most `fmt*()` functions (#95)
  pkgdown cleanup (#226)
  Make argument names in `tab_options()` more consistent with terminology (#221)
  dplyr::data_frame deprecated (#195)
  Remove a unicode character from roxygen documentation (#220)
rich-iannone added a commit that referenced this pull request May 9, 2019
* master: (44 commits)
  Have the table ID be settable, random, or absent in `gt()` (#286)
  Adding the `currency()` helper function for specifying custom currencies (#281)
  Enable table striping options (#236)
  Path expand all file inputs (#278)
  Use webshot to generate images of HTML tables (#257)
  Rewritten vignette for adding summary rows (#273)
  Move roxygen documentation to Markdown (#253)
  Store empty-string value in `sep` vector (#274)
  Bugfixes and improvements to `summary_rows()` (#175)
  Modify _travis.yml (#263)
  Make several refactoring improvements to some `format_*()` functions (#244)
  Include option to hide all column labels (#237)
  Refactoring of formatter functions (#232)
  Improvement to the handling of a `pattern` in most `fmt*()` functions (#95)
  pkgdown cleanup (#226)
  Make argument names in `tab_options()` more consistent with terminology (#221)
  dplyr::data_frame deprecated (#195)
  Remove a unicode character from roxygen documentation (#220)
  Try again, this time with `travis encrypt --com`
  Trying again with github token (#223)
  ...
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.

2 participants