File: options.R

package info (click to toggle)
r-cran-tibble 3.1.8%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 2,008 kB
  • sloc: ansic: 317; sh: 10; makefile: 5
file content (41 lines) | stat: -rw-r--r-- 1,464 bytes parent folder | download | duplicates (2)
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
#' Package options
#'
#' Options that affect interactive display.
#' See [pillar::pillar_options] for options that affect display on the console,
#' and [cli::num_ansi_colors()] for enabling and disabling colored output
#' via ANSI sequences like `[3m[38;5;246m[39m[23m`.
#'
#' These options can be set via [options()] and queried via [getOption()].
#' For this, add a `tibble.` prefix (the package name and a dot) to the option name.
#' Example: for an option `foo`, use `options(tibble.foo = value)` to set it
#' and `getOption("tibble.foo")` to retrieve the current value.
#' An option value of `NULL` means that the default is used.
#'
#' @format NULL
#'
#' @examples
#' # Default setting:
#' getOption("tibble.view_max")
#'
#' # Change for the duration of the session:
#' old <- options(tibble.view_max = 100)
#'
#' # view() would show only 100 rows e.g. for a lazy data frame
#'
#' # Change back to the original value:
#' options(old)
#'
#' # Local scope:
#' local({
#'   rlang::local_options(tibble.view_max = 100)
#'   # view() would show only 100 rows e.g. for a lazy data frame
#' })
#' # view() would show the default 1000 rows e.g. for a lazy data frame
#' @section Options for the tibble package:
tibble_options <- list2(
  #' - `view_max`: Maximum number of rows shown by [view()]
  #'   if the input is not a data frame, passed on to [head()]. Default: `1000`.
  view_max = make_option_impl(
    getOption("tibble.view_max", default = 1000L)
  ),
)