-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
user specified width
does not override getOption("width")
#671
Comments
Thanks. Can you please share your example? |
Sure! I didnt have time to write a good regex earlier, consider the following (only really applicable outside of Rstudio, so in an R session started via a terminal) library(tibble)
data <- lapply(1:20, \(x) sample(1:200, 5)) |>
setNames(nm = sprintf("column_%i", 1:20)) |>
as_tibble()
getOption("width")
#> [1] 80 printing wraps with specified width is > “width” option print(data, width = 100)
#> # A tibble: 5 × 20
#> column_1 column_2 column_3 column_4 column_5 column_6 column_7 column_8
#> <int> <int> <int> <int> <int> <int> <int> <int>
#> 1 9 37 8 195 16 179 122 84
#> 2 69 193 1 34 17 91 45 4
#> 3 113 23 34 11 158 116 10 82
#> 4 172 102 77 149 159 184 80 126
#> 5 61 96 104 152 120 101 2 78
#> column_9 column_10 column_11 column_12 column_13 column_14 column_15 column_16
#> <int> <int> <int> <int> <int> <int> <int> <int>
#> 1 76 116 49 103 189 58 195 38
#> 2 168 4 24 49 76 150 163 47
#> 3 66 155 43 42 103 21 112 122
#> 4 101 83 93 34 151 135 45 59
#> 5 124 190 125 165 112 184 129 168
#> # ℹ 4 more variables: column_17 <int>, column_18 <int>, column_19 <int>, column_20 <int>
options(width = 100)
print(data)
#> # A tibble: 5 × 20
#> column_1 column_2 column_3 column_4 column_5 column_6 column_7 column_8 column_9 column_10
#> <int> <int> <int> <int> <int> <int> <int> <int> <int> <int>
#> 1 9 37 8 195 16 179 122 84 76 116
#> 2 69 193 1 34 17 91 45 4 168 4
#> 3 113 23 34 11 158 116 10 82 66 155
#> 4 172 102 77 149 159 184 80 126 101 83
#> 5 61 96 104 152 120 101 2 78 124 190
#> # ℹ 10 more variables: column_11 <int>, column_12 <int>, column_13 <int>, column_14 <int>,
#> # column_15 <int>, column_16 <int>, column_17 <int>, column_18 <int>, column_19 <int>,
#> # column_20 <int> data wraps again print(data, width = 120)
#> # A tibble: 5 × 20
#> column_1 column_2 column_3 column_4 column_5 column_6 column_7 column_8 column_9 column_10
#> <int> <int> <int> <int> <int> <int> <int> <int> <int> <int>
#> 1 9 37 8 195 16 179 122 84 76 116
#> 2 69 193 1 34 17 91 45 4 168 4
#> 3 113 23 34 11 158 116 10 82 66 155
#> 4 172 102 77 149 159 184 80 126 101 83
#> 5 61 96 104 152 120 101 2 78 124 190
#> column_11 column_12 column_13 column_14 column_15 column_16 column_17 column_18 column_19
#> <int> <int> <int> <int> <int> <int> <int> <int> <int>
#> 1 49 103 189 58 195 38 109 131 117
#> 2 24 49 76 150 163 47 165 198 194
#> 3 43 42 103 21 112 122 175 167 71
#> 4 93 34 151 135 45 59 110 101 183
#> 5 125 165 112 184 129 168 98 122 37
#> # ℹ 1 more variable: column_20 <int> if this is the intended behavior, should it be documented? Created on 2024-09-14 with reprex v2.1.1 |
Thanks. Are any of the options in https://pillar.r-lib.org/reference/pillar_options.html set on your system? |
I was not previously setting these options, but I was able to get the desired effect with
|
Hello Dev team,
I am unsure if the is intentional or not. I found a behavior in which extra columns that do not fit along
getOption("width")
are wrapped onto the new line. Is the expected usage for thewidth
argument intibble::print()
to be leftNULL
now?The text was updated successfully, but these errors were encountered: