Skip to content

Commit

Permalink
Merge branch 'master' into roxygenlabs
Browse files Browse the repository at this point in the history
* master: (30 commits)
  Spanner alignment correction (#662)
  PEN currency fix (#663)
  Fix for `gtsave()` when saving an image and specifying a `path` value (#592)
  Rewrite of RTF building functions and `as_rtf()` (#638)
  v0.2.2 Release Candidate (#629)
  Settable font options (#591)
  Add options for sig figs / inclusion of trailing dec marks (#546)
  Fix issues with defining column widths in `cols_width()` (#561)
  Add `scale_values` arg to `fmt_percent()` (#565)
  Restore row striping option in stub cells (`row.striping.include_stub = TRUE`) (#564)
  Refactor `data_color()` so that it executes faster (#576)
  Update R-CMD-check.yaml (#599)
  Release gt 0.2.1 (#588)
  Ensure that row ordering doesn't affect summary row calculations (#556)
  Update failing example (#586)
  Remove test of scales behaviour
  Squelch warnings from tibble 3.0.0/3.0.1 (#557)
  Bump cache on pkgdown.yaml for GH workflow (#570)
  Update GH Actions workflow for R CMD check (#568)
  Update Description of package to be less confusing (#569)
  ...
  • Loading branch information
rich-iannone committed Oct 25, 2020
2 parents adab986 + 35355c4 commit ead7cd9
Show file tree
Hide file tree
Showing 163 changed files with 23,118 additions and 4,927 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@
^CODE_OF_CONDUCT\.md$
^TODOS
tests/gt-examples
vignettes
99 changes: 99 additions & 0 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
on:
push:
branches:
- master
pull_request:
branches:
- master

name: R-CMD-check

jobs:
R-CMD-check:
runs-on: ${{ matrix.config.os }}

name: ${{ matrix.config.os }} (${{ matrix.r }})

strategy:
fail-fast: false
matrix:
r:
- '3.5'
- '3.6'
- '4.0'
config:
- {os: windows-latest}
- {os: macOS-latest}
- {os: ubuntu-16.04, rspm: "https://demo.rstudiopm.com/all/__linux__/xenial/latest"}

env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
_R_CHECK_FORCE_SUGGESTS_: false
RSPM: ${{ matrix.config.rspm }}
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v2

- uses: r-lib/actions/setup-r@master
with:
r-version: ${{ matrix.r }}

- uses: r-lib/actions/setup-pandoc@master

- name: Query dependencies
run: |
install.packages('remotes')
saveRDS(remotes::dev_package_deps(dependencies = TRUE), "depends.Rds", version = 2)
shell: Rscript {0}

- name: Cache R packages
if: runner.os != 'Windows'
uses: actions/cache@v1
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-r-${{ matrix.r }}-2-${{ hashFiles('depends.Rds') }}
restore-keys: ${{ runner.os }}-r-${{ matrix.r }}-2-

- name: Problematic Pkgs
shell: Rscript {0}
run: |
remotes::install_cran("ellipsis")
remotes::install_cran("pillar")
remotes::install_cran("ps")
remotes::install_cran("processx")
- name: Install system dependencies
if: runner.os == 'Linux'
env:
RHUB_PLATFORM: linux-x86_64-ubuntu-gcc
run: |
Rscript -e "remotes::install_github('r-hub/sysreqs')"
sysreqs=$(Rscript -e "cat(sysreqs::sysreq_commands('DESCRIPTION'))")
sudo -s eval "$sysreqs"
- name: Install dependencies
shell: Rscript {0}
run: |
remotes::install_deps(dependencies = TRUE)
- name: Install rcmdcheck
shell: Rscript {0}
run: |
remotes::install_cran("rcmdcheck")
- name: Check
shell: Rscript {0}
run: rcmdcheck::rcmdcheck(args = "--no-manual", error_on = "warning", check_dir = "check")

- name: Upload check results
if: failure()
uses: actions/upload-artifact@master
with:
name: ${{ runner.os }}-r${{ matrix.r }}-results
path: check

- name: Test coverage
if: matrix.config.os == 'macOS-latest' && matrix.r == '3.6'
shell: Rscript {0}
run: covr::codecov()
42 changes: 42 additions & 0 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
on:
push:
branches: master

name: pkgdown

jobs:
pkgdown:
runs-on: macOS-latest
steps:
- uses: actions/checkout@v2

- uses: r-lib/actions/setup-r@master

- uses: r-lib/actions/setup-pandoc@master

- name: Query dependencies
run: |
install.packages('remotes')
saveRDS(remotes::dev_package_deps(dependencies = TRUE), "depends.Rds", version = 2)
shell: Rscript {0}

- name: Cache R packages
uses: actions/cache@v1
with:
path: ${{ env.R_LIBS_USER }}
key: macOS-r-3.6-1-${{ hashFiles('depends.Rds') }}
restore-keys: macOS-r-3.6-1

- name: Install dependencies
run: |
install.packages("remotes")
remotes::install_deps(dependencies = TRUE)
remotes::install_dev("pkgdown")
shell: Rscript {0}

- name: Install package
run: R CMD INSTALL .

- name: Deploy package
run: pkgdown::deploy_to_branch(new_process = FALSE)
shell: Rscript {0}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
.Rapp.history

# Docs folder from `pkgdown::build_site()`
docs/
docs/dev/
inst/doc

# Session Data files
Expand Down
57 changes: 0 additions & 57 deletions .travis.yml

This file was deleted.

41 changes: 23 additions & 18 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
Type: Package
Package: gt
Version: 0.1.0
Version: 0.2.2
Title: Easily Create Presentation-Ready Display Tables
Description: Build display tables from tabular data using with an easy-to-use
API. With its progressive approach, we can construct display tables with a
clear separation of concerns: you don't have to decide how the tabular data
gets transformed and structured whilst also worrying about aesthetics.
Description: Build display tables from tabular data with an easy-to-use set of
functions. With its progressive approach, we can construct display tables
with a cohesive set of table parts. Table values can be formatted using any
of the included formatting functions. Footnotes and cell styles can be
precisely added through a location targeting system. The way in which 'gt'
handles things for you means that you don't often have to worry about the
fine details.
Authors@R: c(
person("Richard", "Iannone", , "rich@rstudio.com", c("aut", "cre"),
comment = c(ORCID = "0000-0003-3925-190X")),
Expand All @@ -20,26 +23,28 @@ BugReports: https://github.com/rstudio/gt/issues
Encoding: UTF-8
LazyData: true
ByteCompile: true
RoxygenNote: 7.1.0
RoxygenNote: 7.1.1
Roxygen: { library(roxygenlabs); list(markdown = TRUE, roclets = c("collate", "namespace", "roxygenlabs_rd")) }
Depends:
R (>= 3.2.0)
Imports:
checkmate (>= 1.8.5),
Imports:
bitops (>= 1.0.6),
checkmate (>= 2.0.0),
commonmark (>= 1.7),
dplyr (>= 0.7.8),
fs (>= 1.2.6),
ggplot2 (>= 3.1.0),
glue (>= 1.3.0),
htmltools (>= 0.3.6),
dplyr (>= 0.8.5),
fs (>= 1.3.2),
ggplot2 (>= 3.3.0),
glue (>= 1.3.2),
htmltools (>= 0.5.0),
magrittr (>= 1.5),
rlang (>= 0.3.0),
rlang (>= 0.4.5),
sass (>= 0.1.1),
scales (>= 1.1.0),
stringr (>= 1.3.1),
tibble (>= 1.4.2),
tidyselect (>= 0.2.5)
tibble (>= 3.0.0),
tidyselect (>= 1.0.0)
Suggests:
covr,
knitr,
paletteer,
testthat (>= 2.1.0),
Expand All @@ -51,7 +56,7 @@ Suggests:
webshot,
xml2
VignetteBuilder: knitr
Collate:
Collate:
'as_data_frame.R'
'base64.R'
'build_data.R'
Expand Down Expand Up @@ -106,5 +111,5 @@ Collate:
'utils_render_footnotes.R'
'utils_render_html.R'
'utils_render_latex.R'
'utils_render_rtf.R'
'utils_render_rtf_redo.R'
'zzz.R'
1 change: 0 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
YEAR: 2018-2020
COPYRIGHT HOLDER: RStudio, PBC
ORGANIZATION: RStudio, PBC
7 changes: 7 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ export(cols_move_to_end)
export(cols_move_to_start)
export(cols_width)
export(contains)
export(css)
export(currency)
export(data_color)
export(default_fonts)
export(ends_with)
export(escape_latex)
export(everything)
Expand All @@ -50,6 +52,7 @@ export(fmt_percent)
export(fmt_scientific)
export(fmt_time)
export(ggplot_image)
export(google_font)
export(grand_summary_rows)
export(gt)
export(gt_latex_dependencies)
Expand All @@ -59,6 +62,7 @@ export(gtsave)
export(html)
export(info_currencies)
export(info_date_style)
export(info_google_fonts)
export(info_locales)
export(info_paletteer)
export(info_time_style)
Expand All @@ -68,8 +72,10 @@ export(md)
export(one_of)
export(opt_align_table_header)
export(opt_all_caps)
export(opt_css)
export(opt_footnote_marks)
export(opt_row_striping)
export(opt_table_font)
export(opt_table_lines)
export(opt_table_outline)
export(pct)
Expand All @@ -96,6 +102,7 @@ import(rlang)
import(tidyselect)
importFrom(dplyr,vars)
importFrom(ggplot2,ggsave)
importFrom(htmltools,css)
importFrom(magrittr,"%>%")
importFrom(tidyselect,contains)
importFrom(tidyselect,ends_with)
Expand Down
36 changes: 34 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,35 @@
# gt 0.1.0 (unreleased)
# gt 0.2.2

## New features

* The new `opt_table_font()` function makes it possible to define a custom font for the entire **gt** table. The standard fallback fonts are still set by default but the font defined here will take precedence. You could still have different fonts in select locations in the table, and for that you would need to use `tab_style()` in conjunction with the `cell_text()` helper function. The new `google_font()` helper function provides an option for supplying a font available at the Google Fonts service (this is in addition to using system fonts in the `font` argument). Using the `info_google_fonts()` function will provide a table with a set of helpful font recommendations from the *Google Fonts* catalog. The new `default_fonts()` functions provides a helpful vector of system fallback fonts which works well when defining a vector of fonts. (#591)

* The new `opt_css()` function makes allows for the addition of custom CSS to a **gt** table. This CSS will be added after the compiled CSS that **gt** generates automatically when the `gt_tbl` object is transformed to an HTML output table. You can supply `css` as a vector of lines or as a single string. The `css()` function has been re-exported from **htmltools** to make it easier to build CSS style declarations. (Also #591)

* Setting the widths of table columns is now easier and more dependable with `cols_width()`. Widths can be expressed in units of pixels (easily set by use of the `px()` helper function), as percentages (where the `pct()` helper function is useful), or a mixture of the two. The function takes into consideration whether an overall table width has been provided with `tab_options(table.width = ...)`. Providing pixel widths for all columns serves to override any table width defined (yielding columns with the exact widths specified). (#561)

* There are new options for numeric formatting: (1) using significant figures (with `n_sigfig` in `fmt_number`), and (2) the ability to retain/drop trailing decimal marks (with `drop_trailing_dec_mark` in `fmt_number()`, `fmt_percent()`, and `fmt_currency()`). Thank you @drolejoel for the suggestion in #535! (#546).

* The new `scale_values` argument for `fmt_percent()` makes it easy to use values that are already scaled (and just require the percent mark). Thank you @djohn215 for the suggestion in #559. (#565)

* Font weights expressed as numeric values (e.g., `400`, `600`, etc.) in `cell_text()`'s `weight` argument now works properly. (#591)

## Minor improvements and bug fixes

* New package with 39 exported functions for building display tables
* The `data_color()` function has been rewritten to improve performance (#543). (#576)

* Restore the ability to have row striping in stub cells (with `tab_option()`'s `row.striping.include_stub = TRUE`). Thanks @gergness for creating PR #537, which prompted this final fix. (#564)

# gt 0.2.1 (2020-05-26)

* `summary_rows()` and `grand_summary_rows()` no longer incorrectly calculate summary values in cases where rows aren't already sorted by group (#556).

* Ensure compatibility with **tibble** 3.0.0. (#557)

* Adapt tests to changes in dependent packages. (#575)

# gt 0.2.0.5 (2020-03-31)

* New package with 80 exported functions for building display tables

# gt 0.1.0 (unreleased)
3 changes: 1 addition & 2 deletions R/build_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
build_data <- function(data, context) {

checkmate::assert_class(data, "gt_tbl")

# Create `body` with rendered values; move
# input data cells to `body` that didn't have
# any rendering applied during `render_formats()`;
Expand Down Expand Up @@ -58,7 +57,7 @@ build_data <- function(data, context) {

# Add footnote marks to the `summary` cells
# TODO: `context` is missing in `apply_footnotes_to_summary()`
data <- apply_footnotes_to_summary(data = data)
data <- apply_footnotes_to_summary(data = data, context = context)

data <- dt_has_built_set(data = data, value = TRUE)

Expand Down

0 comments on commit ead7cd9

Please sign in to comment.