Skip to content

Commit 756b838

Browse files
authored
Merge pull request #942 from tidyverse/docs-891-options-link
- Various documentation improvements.
2 parents 6df07e5 + 155b24d commit 756b838

File tree

8 files changed

+45
-36
lines changed

8 files changed

+45
-36
lines changed

DESCRIPTION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ Suggests:
7070
VignetteBuilder:
7171
knitr
7272
Remotes:
73+
r-lib/rlang,
7374
r-lib/pillar@v1.6.2
7475
Encoding: UTF-8
7576
Roxygen: list(markdown = TRUE)

R/options.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
#' Package options
22
#'
33
#' Options that affect interactive display.
4-
#' See [pillar_options] for options that affect display on the console.
4+
#' See [pillar::pillar_options] for options that affect display on the console,
5+
#' and [cli::num_ansi_colors()] for enabling and disabling colored output
6+
#' via ANSI sequences like `[3m[38;5;246m[39m[23m`.
57
#'
68
#' These options can be set via [options()] and queried via [getOption()].
79
#' For this, add a `tibble.` prefix (the package name and a dot) to the option name.

R/print.R

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,31 +12,31 @@
1212
#'
1313
#' Printing can be tweaked for a one-off call by calling `print()` explicitly
1414
#' and setting arguments like `n` and `width`. More persistent control is
15-
#' available by setting the options described in [pillar_options].
15+
#' available by setting the options described in [pillar::pillar_options].
1616
#' See also `vignette("digits", package = "pillar")` for a comparison to base options,
1717
#' and [num()] and [char()] for creating columns with custom formatting options.
1818
#'
1919
#' As of tibble 3.1.0, printing is handled entirely by the \pkg{pillar} package.
2020
#' If you implement a package that extends tibble,
2121
#' the printed output can be customized in various ways.
2222
#' See `vignette("extending", package = "pillar")` for details,
23-
#' and [pillar_options] for options that control the display in the console.
23+
#' and [pillar::pillar_options] for options that control the display in the console.
2424
#'
2525
# Copied from pillar::format.tbl() to avoid roxygen2 warning
2626
#' @param x Object to format or print.
2727
#' @param ... Passed on to [tbl_format_setup()].
2828
#' @param n Number of rows to show. If `NULL`, the default, will print all rows
29-
#' if less than the `print_max` [option][pillar_options].
29+
#' if less than the `print_max` [option][pillar::pillar_options].
3030
#' Otherwise, will print as many rows as specified by the
31-
#' `print_min` [option][pillar_options].
31+
#' `print_min` [option][pillar::pillar_options].
3232
#' @param width Width of text output to generate. This defaults to `NULL`, which
33-
#' means use the `width` [option][pillar_options].
33+
#' means use the `width` [option][pillar::pillar_options].
3434
#' @param max_extra_cols Number of extra columns to print abbreviated information for,
3535
#' if the width is too small for the entire tibble. If `NULL`,
36-
#' the `max_extra_cols` [option][pillar_options] is used.
36+
#' the `max_extra_cols` [option][pillar::pillar_options] is used.
3737
#' The previously defined `n_extra` argument is soft-deprecated.
3838
#' @param max_footer_lines Maximum number of footer lines. If `NULL`,
39-
#' the `max_footer_lines` [option][pillar_options] is used.
39+
#' the `max_footer_lines` [option][pillar::pillar_options] is used.
4040
#'
4141
#' @examples
4242
#' print(as_tibble(mtcars))

man/formatting.Rd

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/tibble_options.Rd

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/_snaps/vignette-tibble/tibble.md

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -148,33 +148,35 @@ It also prints an abbreviated description of the column type, and uses font styl
148148

149149

150150
```r
151-
tibble(x = -5:1000)
151+
tibble(x = -5:100, y = 123.456 * (3 ^ x))
152152
```
153153

154-
<div class="sourceCode"><pre class="sourceCode"><code class="sourceCode"><span style='color: #555555;'>#&gt;</span> <span style='color: #555555;'># A tibble: 1,006 x 1</span>
155-
<span style='color: #555555;'>#&gt;</span> <span style='font-weight: bold;'>x</span>
156-
<span style='color: #555555;'>#&gt;</span> <span style='color: #555555; font-style: italic;'>&lt;int&gt;</span>
157-
<span style='color: #555555;'>#&gt;</span> <span style='color: #555555;'> 1</span> -<span style='color: #BB0000;'>5</span>
158-
<span style='color: #555555;'>#&gt;</span> <span style='color: #555555;'> 2</span> -<span style='color: #BB0000;'>4</span>
159-
<span style='color: #555555;'>#&gt;</span> <span style='color: #555555;'> 3</span> -<span style='color: #BB0000;'>3</span>
160-
<span style='color: #555555;'>#&gt;</span> <span style='color: #555555;'> 4</span> -<span style='color: #BB0000;'>2</span>
161-
<span style='color: #555555;'>#&gt;</span> <span style='color: #555555;'> 5</span> -<span style='color: #BB0000;'>1</span>
162-
<span style='color: #555555;'>#&gt;</span> <span style='color: #555555;'> 6</span> 0
163-
<span style='color: #555555;'>#&gt;</span> <span style='color: #555555;'> 7</span> 1
164-
<span style='color: #555555;'>#&gt;</span> <span style='color: #555555;'> 8</span> 2
165-
<span style='color: #555555;'>#&gt;</span> <span style='color: #555555;'> 9</span> 3
166-
<span style='color: #555555;'>#&gt;</span> <span style='color: #555555;'>10</span> 4
167-
<span style='color: #555555;'>#&gt;</span> <span style='color: #555555;'># ... with 996 more rows</span>
154+
<div class="sourceCode"><pre class="sourceCode"><code class="sourceCode"><span style='color: #555555;'>#&gt;</span> <span style='color: #555555;'># A tibble: 106 x 2</span>
155+
<span style='color: #555555;'>#&gt;</span> <span style='font-weight: bold;'>x</span> <span style='font-weight: bold;'>y</span>
156+
<span style='color: #555555;'>#&gt;</span> <span style='color: #555555; font-style: italic;'>&lt;int&gt;</span> <span style='color: #555555; font-style: italic;'>&lt;dbl&gt;</span>
157+
<span style='color: #555555;'>#&gt;</span> <span style='color: #555555;'> 1</span> -<span style='color: #BB0000;'>5</span> 0.508
158+
<span style='color: #555555;'>#&gt;</span> <span style='color: #555555;'> 2</span> -<span style='color: #BB0000;'>4</span> 1.52
159+
<span style='color: #555555;'>#&gt;</span> <span style='color: #555555;'> 3</span> -<span style='color: #BB0000;'>3</span> 4.57
160+
<span style='color: #555555;'>#&gt;</span> <span style='color: #555555;'> 4</span> -<span style='color: #BB0000;'>2</span> 13.7
161+
<span style='color: #555555;'>#&gt;</span> <span style='color: #555555;'> 5</span> -<span style='color: #BB0000;'>1</span> 41.2
162+
<span style='color: #555555;'>#&gt;</span> <span style='color: #555555;'> 6</span> 0 123.
163+
<span style='color: #555555;'>#&gt;</span> <span style='color: #555555;'> 7</span> 1 370.
164+
<span style='color: #555555;'>#&gt;</span> <span style='color: #555555;'> 8</span> 2 <span style='text-decoration: underline;'>1</span>111.
165+
<span style='color: #555555;'>#&gt;</span> <span style='color: #555555;'> 9</span> 3 <span style='text-decoration: underline;'>3</span>333.
166+
<span style='color: #555555;'>#&gt;</span> <span style='color: #555555;'>10</span> 4 <span style='text-decoration: underline;'>10</span>000.
167+
<span style='color: #555555;'>#&gt;</span> <span style='color: #555555;'># ... with 96 more rows</span>
168168
</code></pre></div>
169169

170+
Numbers are displayed with three significant figures by default, and a trailing dot that indicates the existence of a fractional component.
171+
170172
You can control the default appearance with options:
171173

172-
* `options(tibble.print_max = n, tibble.print_min = m)`: if there are more than `n` rows, print only the first `m` rows.
173-
Use `options(tibble.print_max = Inf)` to always show all rows.
174+
* `options(pillar.print_max = n, pillar.print_min = m)`: if there are more than `n` rows, print only the first `m` rows.
175+
Use `options(pillar.print_max = Inf)` to always show all rows.
174176

175-
* `options(tibble.width = Inf)` will always print all columns, regardless of the width of the screen.
177+
* `options(pillar.width = n)`: use `n` character slots horizontally to show the data. If `n > getOption("width")`, this will result in multiple tiers. Use `options(pillar.width = Inf)` to always print all columns, regardless of the width of the screen.
176178

177-
See `?"tibble-package"` for the available options, and `vignette("types")` for an overview of the type abbreviations.
179+
See `?pillar::pillar_options` and `?tibble_options` for the available options, `vignette("types")` for an overview of the type abbreviations, and `vignette("digits", package = "pillar")` for details on the formatting of numbers.
178180

179181
### Subsetting
180182

tests/testthat/test-vignette-tibble.R

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
test_that("tibble vignette", {
2+
# Unclear
3+
skip_on_ci()
24
skip_if_not_installed("rlang", "0.4.11.9001")
35

46
test_galley("tibble")

vignettes/tibble.Rmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ You can control the default appearance with options:
143143

144144
* `options(pillar.width = n)`: use `n` character slots horizontally to show the data. If `n > getOption("width")`, this will result in multiple tiers. Use `options(pillar.width = Inf)` to always print all columns, regardless of the width of the screen.
145145

146-
See `?pillar_options` and `?tibble_options` for the available options, `vignette("types")` for an overview of the type abbreviations, and `vignette("digits", package = "pillar")` for details on the formatting of numbers.
146+
See `?pillar::pillar_options` and `?tibble_options` for the available options, `vignette("types")` for an overview of the type abbreviations, and `vignette("digits", package = "pillar")` for details on the formatting of numbers.
147147

148148
### Subsetting
149149

0 commit comments

Comments
 (0)