Print All (or More) of an Object
print_all.Rd
print_all()
is a generic function for extended printing of an object, for instance printing all rows of a tibble,
a derived class or even a regular data frame, optionally following up by printing a specified number of linefeeds.
Being a generic function, new printing methods can be easily added for a new class
.
Usage
print_all(x, ...)
# S3 method for class 'data.frame'
print_all(
x,
linefeeds = NULL,
...,
digits = NULL,
quote = FALSE,
right = TRUE,
row.names = TRUE,
max = NULL
)
# S3 method for class 'tbl'
print_all(
x,
linefeeds = NULL,
width = NULL,
...,
max_extra_cols = NULL,
max_footer_lines = NULL
)
# S3 method for class 'tbl_df'
print_all(
x,
linefeeds = NULL,
width = NULL,
...,
max_extra_cols = NULL,
max_footer_lines = NULL
)
# S3 method for class 'odds_ratio'
print_all(x, linefeeds = NULL, ...)
# S3 method for class 'htest'
print_all(x, ...)
Arguments
- x
An object such as a
tibble
data frame.- ...
further arguments passed to or from other methods.
- linefeeds
A positive integer specifying the number of linefeeds to follow up the printed output; default
NULL
.- digits
minimal number of significant digits, see
print.default
.- quote
logical, indicating whether or not strings should be printed with surrounding quotes.
- right
logical, indicating whether or not strings should be right aligned.
- row.names
logical (or character vector), indicating whether (or what) row names should be printed.
- max
numeric or
NULL
, specifying the maximal number of entries to be printed. By default, whenNULL
,getOption("max.print")
used.- width
only used when
max.levels
is NULL, see above.- max_extra_cols
Number of extra columns to print abbreviated information for, if the width is too small for the entire tibble. If
NULL
, themax_extra_cols
option is used. The previously definedn_extra
argument is soft-deprecated.Maximum number of footer lines. If
NULL
, themax_footer_lines
option is used.
Details
For a tibble
x
, print_all(x)
is equivalent to
print(x, n = nrow(x))
, followed up if required by n linefeeds generated as if by using
cat(rep("\n", n))
.
The linefeeds
argument may be useful within a piped sequence to separate output from subsequent printing. If
a vector of length > 1
is entered for linefeeds
, only the first element will be used, and negative
integers will be converted to zero i.e., no line feeds.
See also
Other print:
Print_Methods
,
announce()
,
lf()
Examples
(tib <- tibble(x = 1:26, y = LETTERS[x], z = paste0(x, y)))
#> # A tibble: 26 × 3
#> x y z
#> <int> <chr> <chr>
#> 1 1 A 1A
#> 2 2 B 2B
#> 3 3 C 3C
#> 4 4 D 4D
#> 5 5 E 5E
#> 6 6 F 6F
#> 7 7 G 7G
#> 8 8 H 8H
#> 9 9 I 9I
#> 10 10 J 10J
#> # ℹ 16 more rows
tib |> print_all()
#> # A tibble: 26 × 3
#> x y z
#> <int> <chr> <chr>
#> 1 1 A 1A
#> 2 2 B 2B
#> 3 3 C 3C
#> 4 4 D 4D
#> 5 5 E 5E
#> 6 6 F 6F
#> 7 7 G 7G
#> 8 8 H 8H
#> 9 9 I 9I
#> 10 10 J 10J
#> 11 11 K 11K
#> 12 12 L 12L
#> 13 13 M 13M
#> 14 14 N 14N
#> 15 15 O 15O
#> 16 16 P 16P
#> 17 17 Q 17Q
#> 18 18 R 18R
#> 19 19 S 19S
#> 20 20 T 20T
#> 21 21 U 21U
#> 22 22 V 22V
#> 23 23 W 23W
#> 24 24 X 24X
#> 25 25 Y 25Y
#> 26 26 Z 26Z
tib |> print_all() |> names()
#> # A tibble: 26 × 3
#> x y z
#> <int> <chr> <chr>
#> 1 1 A 1A
#> 2 2 B 2B
#> 3 3 C 3C
#> 4 4 D 4D
#> 5 5 E 5E
#> 6 6 F 6F
#> 7 7 G 7G
#> 8 8 H 8H
#> 9 9 I 9I
#> 10 10 J 10J
#> 11 11 K 11K
#> 12 12 L 12L
#> 13 13 M 13M
#> 14 14 N 14N
#> 15 15 O 15O
#> 16 16 P 16P
#> 17 17 Q 17Q
#> 18 18 R 18R
#> 19 19 S 19S
#> 20 20 T 20T
#> 21 21 U 21U
#> 22 22 V 22V
#> 23 23 W 23W
#> 24 24 X 24X
#> 25 25 Y 25Y
#> 26 26 Z 26Z
#> [1] "x" "y" "z"
tib |> print_all(linefeeds = 3) |> names()
#> # A tibble: 26 × 3
#> x y z
#> <int> <chr> <chr>
#> 1 1 A 1A
#> 2 2 B 2B
#> 3 3 C 3C
#> 4 4 D 4D
#> 5 5 E 5E
#> 6 6 F 6F
#> 7 7 G 7G
#> 8 8 H 8H
#> 9 9 I 9I
#> 10 10 J 10J
#> 11 11 K 11K
#> 12 12 L 12L
#> 13 13 M 13M
#> 14 14 N 14N
#> 15 15 O 15O
#> 16 16 P 16P
#> 17 17 Q 17Q
#> 18 18 R 18R
#> 19 19 S 19S
#> 20 20 T 20T
#> 21 21 U 21U
#> 22 22 V 22V
#> 23 23 W 23W
#> 24 24 X 24X
#> 25 25 Y 25Y
#> 26 26 Z 26Z
#>
#>
#>
#> [1] "x" "y" "z"
df <- tib |> as.data.frame()
df |> print_all() ## Does nothing more than regular print()
#> x y z
#> 1 1 A 1A
#> 2 2 B 2B
#> 3 3 C 3C
#> 4 4 D 4D
#> 5 5 E 5E
#> 6 6 F 6F
#> 7 7 G 7G
#> 8 8 H 8H
#> 9 9 I 9I
#> 10 10 J 10J
#> 11 11 K 11K
#> 12 12 L 12L
#> 13 13 M 13M
#> 14 14 N 14N
#> 15 15 O 15O
#> 16 16 P 16P
#> 17 17 Q 17Q
#> 18 18 R 18R
#> 19 19 S 19S
#> 20 20 T 20T
#> 21 21 U 21U
#> 22 22 V 22V
#> 23 23 W 23W
#> 24 24 X 24X
#> 25 25 Y 25Y
#> 26 26 Z 26Z
df |> print_all(linefeeds = 2) |> names() ## Regular data frame printing, with line feeds
#> x y z
#> 1 1 A 1A
#> 2 2 B 2B
#> 3 3 C 3C
#> 4 4 D 4D
#> 5 5 E 5E
#> 6 6 F 6F
#> 7 7 G 7G
#> 8 8 H 8H
#> 9 9 I 9I
#> 10 10 J 10J
#> 11 11 K 11K
#> 12 12 L 12L
#> 13 13 M 13M
#> 14 14 N 14N
#> 15 15 O 15O
#> 16 16 P 16P
#> 17 17 Q 17Q
#> 18 18 R 18R
#> 19 19 S 19S
#> 20 20 T 20T
#> 21 21 U 21U
#> 22 22 V 22V
#> 23 23 W 23W
#> 24 24 X 24X
#> 25 25 Y 25Y
#> 26 26 Z 26Z
#>
#>
#> [1] "x" "y" "z"
binom_data(26, 100) |>
odds_ratio(.dep_var = cbind(pn, qn), .ind_var = iv) |>
print_all()
#> Waiting for profiling to be done...
#> ____________________________
#> Estimates and Odds Ratios: -
#>
#> # A tibble: 26 × 7
#> parameter estimate se p_val odds_ratio ci[,"2.5%"] [,"97.5%"] sig
#> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <fct>
#> 1 (Intercept) 0.201 0.201 0.318 1 NA NA NS
#> 2 ivb -0.121 0.284 0.671 0.886 0.507 1.55 NS
#> 3 ivc -0.523 0.285 0.0666 0.592 0.337 1.03 .
#> 4 ivd -0.161 0.284 0.571 0.852 0.488 1.48 NS
#> 5 ive -0.401 0.284 0.158 0.669 0.382 1.17 NS
#> 6 ivf -0.442 0.285 0.121 0.643 0.367 1.12 NS
#> 7 ivg -0.648 0.287 0.0240 0.523 0.296 0.915 *
#> 8 ivh -0.954 0.294 0.00116 0.385 0.215 0.681 **
#> 9 ivi -1.00 0.295 0.000699 0.368 0.204 0.652 ***
#> 10 ivj -0.733 0.289 0.0111 0.481 0.271 0.843 *
#> 11 ivk -0.864 0.291 0.00304 0.421 0.236 0.743 **
#> 12 ivl -0.820 0.290 0.00477 0.441 0.248 0.775 **
#> 13 ivm -1.00 0.295 0.000699 0.368 0.204 0.652 ***
#> 14 ivn -1.15 0.300 0.000135 0.318 0.175 0.568 ***
#> 15 ivo -0.954 0.294 0.00116 0.385 0.215 0.681 **
#> 16 ivp -1.20 0.302 0.0000752 0.303 0.166 0.542 ***
#> 17 ivq -1.20 0.302 0.0000752 0.303 0.166 0.542 ***
#> 18 ivr -1.47 0.314 0.000003 0.231 0.123 0.422 ***
#> 19 ivs -1.25 0.304 0.000041 0.287 0.157 0.517 ***
#> 20 ivt -1.20 0.302 0.0000752 0.303 0.166 0.542 ***
#> 21 ivu -1.59 0.321 0.0000008 0.205 0.107 0.378 ***
#> 22 ivv -1.72 0.329 0.0000002 0.180 0.0923 0.337 ***
#> 23 ivw -2.19 0.368 0 0.112 0.0523 0.223 ***
#> 24 ivx -2.29 0.378 0 0.101 0.0462 0.205 ***
#> 25 ivy -1.86 0.339 0 0.156 0.0782 0.297 ***
#> 26 ivz -2.79 0.440 0 0.0616 0.0240 0.138 ***
rm(df, tib)