Skip to contents

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, when NULL, 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, the max_extra_cols option is used. The previously defined n_extra argument is soft-deprecated.

Maximum number of footer lines. If NULL, the max_footer_lines option is used.

Value

Invisibly returns its argument.

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

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.160  0.201 0.424         1          NA          NA     NS   
#>  2 ivb          -0.0402 0.284 0.887         0.961       0.550       1.68  NS   
#>  3 ivc          -0.650  0.288 0.0238        0.522       0.296       0.914 *    
#>  4 ivd          -0.524  0.286 0.0664        0.592       0.337       1.03  .    
#>  5 ive          -0.240  0.283 0.396         0.786       0.450       1.37  NS   
#>  6 ivf          -0.608  0.287 0.0342        0.545       0.309       0.953 *    
#>  7 ivg          -0.483  0.285 0.0902        0.617       0.351       1.08  .    
#>  8 ivh          -0.869  0.292 0.00297       0.420       0.235       0.740 **   
#>  9 ivi          -0.608  0.287 0.0342        0.545       0.309       0.953 *    
#> 10 ivj          -1.01   0.296 0.000676      0.365       0.202       0.649 ***  
#> 11 ivk          -0.693  0.288 0.0163        0.500       0.283       0.877 *    
#> 12 ivl          -1.37   0.311 0.0000108     0.254       0.136       0.463 ***  
#> 13 ivm          -1.15   0.302 0.000129      0.315       0.173       0.565 ***  
#> 14 ivn          -1.15   0.302 0.000129      0.315       0.173       0.565 ***  
#> 15 ivo          -1.21   0.304 0.0000713     0.299       0.163       0.538 ***  
#> 16 ivp          -1.31   0.308 0.0000206     0.269       0.145       0.487 ***  
#> 17 ivq          -1.49   0.317 0.0000028     0.226       0.120       0.416 ***  
#> 18 ivr          -0.869  0.292 0.00297       0.420       0.235       0.740 **   
#> 19 ivs          -1.75   0.333 0.0000002     0.174       0.0887      0.330 ***  
#> 20 ivt          -1.61   0.324 0.0000007     0.200       0.104       0.372 ***  
#> 21 ivu          -1.43   0.314 0.0000055     0.240       0.128       0.439 ***  
#> 22 ivv          -1.75   0.333 0.0000002     0.174       0.0887      0.330 ***  
#> 23 ivw          -2.47   0.403 0             0.0842      0.0361      0.178 ***  
#> 24 ivx          -2.15   0.367 0             0.116       0.0544      0.232 ***  
#> 25 ivy          -2.15   0.367 0             0.116       0.0544      0.232 ***  
#> 26 ivz          -2.25   0.377 0             0.105       0.0481      0.214 ***  

rm(df, tib)