/
tibble-opt.R
54 lines (44 loc) · 935 Bytes
/
tibble-opt.R
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
tibble_opt <- function(x, default) {
x_tibble <- paste0("tibble.", x)
res <- getOption(x_tibble)
if (!is.null(res)) {
return(res)
}
x_dplyr <- paste0("dplyr.", x)
res <- getOption(x_dplyr)
if (!is.null(res)) {
return(res)
}
default
}
get_width_print <- function(width) {
if (!is.null(width)) {
return(width)
}
get_pillar_option_width()
}
get_width_glimpse <- function(width) {
width <- get_width_print(width)
if (is.finite(width)) {
width
} else {
getOption("width")
}
}
get_n_print <- function(n, rows) {
if (!is.null(n) && n >= 0) {
return(n)
}
if (is.na(rows) || rows > get_pillar_option_print_max()) {
get_pillar_option_print_min()
} else {
rows
}
}
get_max_extra_cols <- function(max_extra_cols) {
# FIXME: Deprecate
if (!is.null(max_extra_cols) && max_extra_cols >= 0) {
return(max_extra_cols)
}
get_pillar_option_max_extra_cols()
}