-
Notifications
You must be signed in to change notification settings - Fork 197
/
_pkgdown.yml
301 lines (281 loc) · 9.15 KB
/
_pkgdown.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
destination: docs
home:
strip_header: true
url: https://gt.rstudio.com
template:
bootstrap: 5
authors:
JooYoung Seo:
href: "https://jooyoungseo.github.io/"
development:
mode: auto
version_label: default
reference:
- title: Create Table
desc: >
All **gt** tables begin with a call to `gt()`, where we would supply the
input data table (data frame or tibble) and some basic options for
creating a stub (`rowname_col`) and row groups (`groupname_col`). We
can also introduce a grouped tibble (via **dplyr**'s `group_by()`) for
more precise divisions of rows into row groups. The `gt_preview()`
function is great for getting a nicely-formatted preview of a data
table (defaulting to the first 5 rows and the last row).
contents:
- gt
- gt_preview
- title: Create or Modify Parts
desc: >
A **gt** table can contain a few useful parts for conveying additional
information. These include a header (with a titles and subtitle), a
footer (with footnotes and source notes), and additional areas for
labels (row group labels, column spanner labels, the stubhead label).
We can modify the look of table parts more generally with
`tab_options()` and perform styling on targeted table locations with
`tab_style()`.
contents:
- tab_header
- tab_spanner
- tab_spanner_delim
- tab_row_group
- tab_stubhead
- tab_stub_indent
- tab_footnote
- tab_source_note
- tab_caption
- tab_style
- tab_style_body
- tab_options
- tab_info
- title: Format Data
desc: >
Columns of data can be formatted with the `fmt_*()` functions. We can
specify the rows of these columns quite precisely with the `rows`
argument. We get to apply these functions exactly once to each data
cell (last call wins). Need to do custom formatting? Use the `fmt()`
function and define your own formatter within (or, create a wrapper
with `fmt()` if you prefer). The `text_transform()` function allows
for post-processing of any data, and we provide a function for that
transformation.
contents:
- fmt_number
- fmt_integer
- fmt_scientific
- fmt_engineering
- fmt_percent
- fmt_partsper
- fmt_fraction
- fmt_currency
- fmt_roman
- fmt_bytes
- fmt_date
- fmt_time
- fmt_datetime
- fmt_duration
- fmt_markdown
- fmt_passthrough
- fmt
- sub_missing
- sub_zero
- sub_small_vals
- sub_large_vals
- sub_values
- text_transform
- data_color
- title: Modify Columns
desc: >
The `cols_*()` functions allow for modifications that act on entire
columns. This includes alignment of the data in columns
(`cols_align()`), hiding columns from view (`cols_hide()`),
re-labeling the column labels (`cols_label()`), merging two columns
together (`cols_merge*()`), moving columns around (`cols_move*()`).
contents:
- cols_align
- cols_align_decimal
- cols_width
- cols_label
- cols_move_to_start
- cols_move_to_end
- cols_move
- cols_hide
- cols_unhide
- cols_merge_uncert
- cols_merge_range
- cols_merge_n_pct
- cols_merge
- title: Add or Modify Rows
desc: >
There are two functions that will add rows to a **gt** table:
`summary_rows()` and `grand_summary_rows()`. These functions will both add
summary rows but one will do it in a groupwise fashion while the other
will create grand summary rows. The `row_group_order()` function lets us
modify the ordering of any row groups in the table.
contents:
- summary_rows
- grand_summary_rows
- row_group_order
- title: Remove Parts of a Table
desc: >
The `rm_*()` functions let us safely remove parts of a **gt** table. This
can be advantageous in those instances where you would obtain a **gt**
table but prefer to excise some parts of it.
contents:
- rm_header
- rm_stubhead
- rm_spanners
- rm_footnotes
- rm_source_notes
- rm_caption
- title: Helper Functions
desc: >
An assortment of helper functions is available in the **gt** package.
The various `cells_*()` functions are used for targeting cells with the
`locations` argument in the `tab_footnote()`, `tab_style()`, and
`text_transform()` functions. The `cells_styles()` function is used
exclusively with `tab_style()`'s `style` argument (and the `px()` &
`pct()` functions may be useful there for specifying units in pixels or
percentages). The `md()` and `html()` helpers can used be during label
creation with the `tab_header()`, `tab_footnote()`, `tab_spanner()`,
`tab_stubhead_label()`, and `tab_source_note()` functions.
contents:
- md
- html
- px
- pct
- stub
- cells_title
- cells_stubhead
- cells_column_spanners
- cells_column_labels
- cells_row_groups
- cells_stub
- cells_body
- cells_summary
- cells_grand_summary
- cells_stub_summary
- cells_stub_grand_summary
- cells_footnotes
- cells_source_notes
- currency
- cell_text
- cell_fill
- cell_borders
- adjust_luminance
- random_id
- escape_latex
- gt_latex_dependencies
- default_fonts
- google_font
- title: Image Addition Functions
desc: >
We can add images into a **gt** table with the help of the `*_image()`
functions. Two common ways to do this: (1) use `text_transform()` to
insert images into data cells, (2) use any function that creates
new labels (e.g., `tab_header()`) and use a `*_image()` function
within the `html()` helper.
contents:
- web_image
- local_image
- ggplot_image
- test_image
- title: Table Option Functions
desc: >
With the `opt_*()` functions, we have an easy way to set commonly-used
table options without having to use `tab_options()` directly. For
instance, we can modify the set of marks to use with footnotes, turn on
row striping, change the alignment of the table header, and much more.
contents:
- opt_footnote_marks
- opt_row_striping
- opt_align_table_header
- opt_vertical_padding
- opt_horizontal_padding
- opt_all_caps
- opt_table_lines
- opt_table_outline
- opt_table_font
- opt_stylize
- opt_css
- title: Information Functions
desc: >
These `info_*()` functions present us with **gt** tables containing
useful information. So far, we can get reference information on
date styles (`info_date_style()`), on time styles
(`info_time_style()`), on a huge number of color palettes
(`info_paletteer()`), on currencies (`info_currencies()`), on
all of the different locales supported in the formatter functions
(`info_locales()`), and on our recommendations for which Google Fonts
to try in your tables.
contents:
- info_date_style
- info_time_style
- info_currencies
- info_locales
- info_paletteer
- info_google_fonts
- title: Datasets
desc: >
The **gt** package is equipped with six datasets that come in all shapes
and sizes. Use them to experiment with the package. Many examples in the
internal help documents use these datasets to quickly demonstrate the key
features of **gt**.
contents:
- countrypops
- sza
- gtcars
- sp500
- pizzaplace
- exibble
- title: Shiny Functions
desc: >
Shiny is great for building interactive web apps with R. There's
really nothing quite like it. The **gt** package includes two
functions that work nicely with Shiny: a table render function
`render_gt()` (for the `server`) and a table output element
`gt_output()` (for the `ui`).
contents:
- render_gt
- gt_output
- title: Export Functions
desc: >
There may come a day when you need to export a **gt** table to some
specific format. A great function for that is `gtsave()`, which allows
us to save as an HTML file or an image file. Some other functions give us
table code as a character vector (e.g., `as_raw_html()`). Did you use the
`summary_rows()` function and wish you had that summary data in a tibble?
You can get it out with `extract_summary()`.
contents:
- gtsave
- as_raw_html
- as_latex
- as_rtf
- as_word
- extract_summary
- extract_cells
- title: Vector Formatting Functions
desc: >
Why should columns have all the formatting fun? If you have vectors in
need of formatting, we have a set of `vec_fmt_*()` functions that have
been adapted from the corresponding `fmt_*()` functions.
contents:
- vec_fmt_number
- vec_fmt_integer
- vec_fmt_scientific
- vec_fmt_engineering
- vec_fmt_percent
- vec_fmt_partsper
- vec_fmt_fraction
- vec_fmt_currency
- vec_fmt_roman
- vec_fmt_bytes
- vec_fmt_date
- vec_fmt_time
- vec_fmt_datetime
- vec_fmt_duration
- vec_fmt_markdown
navbar:
structure:
left: [intro, articles, reference, news]
components:
intro:
text: Intro
href: articles/intro-creating-gt-tables.html