Tools for describing matrices

# S3 method for tbl
format(x, ..., n = NULL, width = NULL, n_extra = NULL)

# S3 method for tbl_df
format(x, ..., n = NULL, width = NULL, n_extra = NULL)

# S3 method for tbl
print(x, ..., n = NULL, width = NULL, n_extra = NULL)

# S3 method for tbl_df
print(x, ..., n = NULL, width = NULL, n_extra = NULL)

trunc_mat(x, n = NULL, width = NULL, n_extra = NULL)

Arguments

x

Object to show.

n

Number of rows to show. If NULL, the default, will print all rows if less than option tibble.print_max. Otherwise, will print tibble.print_min rows.

width

Width of text output to generate. This defaults to NULL, which means use getOption("tibble.width") or (if also NULL) getOption("width"); the latter displays only the columns that fit on one screen. You can also set options(tibble.width = Inf) to override this default and always print all columns.

n_extra

Number of extra columns to print abbreviated information for, if the width is too small for the entire tibble. If NULL, the default, will print information about at most tibble.max_extra_cols extra columns.

See also

tibble-package

Examples

trunc_mat(mtcars)
#> # data.frame [32 × 11] #> mpg cyl disp hp drat wt qsec vs am gear carb #> * <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 21.0 6.00 160 110 3.90 2.62 16.5 0 1.00 4.00 4.00 #> 2 21.0 6.00 160 110 3.90 2.88 17.0 0 1.00 4.00 4.00 #> 3 22.8 4.00 108 93.0 3.85 2.32 18.6 1.00 1.00 4.00 1.00 #> 4 21.4 6.00 258 110 3.08 3.22 19.4 1.00 0 3.00 1.00 #> 5 18.7 8.00 360 175 3.15 3.44 17.0 0 0 3.00 2.00 #> 6 18.1 6.00 225 105 2.76 3.46 20.2 1.00 0 3.00 1.00 #> 7 14.3 8.00 360 245 3.21 3.57 15.8 0 0 3.00 4.00 #> 8 24.4 4.00 147 62.0 3.69 3.19 20.0 1.00 0 4.00 2.00 #> 9 22.8 4.00 141 95.0 3.92 3.15 22.9 1.00 0 4.00 2.00 #> 10 19.2 6.00 168 123 3.92 3.44 18.3 1.00 0 4.00 4.00 #> # ... with 22 more rows
print(as_tibble(mtcars))
#> # A tibble: 32 x 11 #> mpg cyl disp hp drat wt qsec vs am gear carb #> * <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 21.0 6.00 160 110 3.90 2.62 16.5 0 1.00 4.00 4.00 #> 2 21.0 6.00 160 110 3.90 2.88 17.0 0 1.00 4.00 4.00 #> 3 22.8 4.00 108 93.0 3.85 2.32 18.6 1.00 1.00 4.00 1.00 #> 4 21.4 6.00 258 110 3.08 3.22 19.4 1.00 0 3.00 1.00 #> 5 18.7 8.00 360 175 3.15 3.44 17.0 0 0 3.00 2.00 #> 6 18.1 6.00 225 105 2.76 3.46 20.2 1.00 0 3.00 1.00 #> 7 14.3 8.00 360 245 3.21 3.57 15.8 0 0 3.00 4.00 #> 8 24.4 4.00 147 62.0 3.69 3.19 20.0 1.00 0 4.00 2.00 #> 9 22.8 4.00 141 95.0 3.92 3.15 22.9 1.00 0 4.00 2.00 #> 10 19.2 6.00 168 123 3.92 3.44 18.3 1.00 0 4.00 4.00 #> # ... with 22 more rows
print(as_tibble(mtcars), n = 1)
#> # A tibble: 32 x 11 #> mpg cyl disp hp drat wt qsec vs am gear carb #> * <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 21.0 6.00 160 110 3.90 2.62 16.5 0 1.00 4.00 4.00 #> # ... with 31 more rows
print(as_tibble(mtcars), n = 3)
#> # A tibble: 32 x 11 #> mpg cyl disp hp drat wt qsec vs am gear carb #> * <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 21.0 6.00 160 110 3.90 2.62 16.5 0 1.00 4.00 4.00 #> 2 21.0 6.00 160 110 3.90 2.88 17.0 0 1.00 4.00 4.00 #> 3 22.8 4.00 108 93.0 3.85 2.32 18.6 1.00 1.00 4.00 1.00 #> # ... with 29 more rows
print(as_tibble(mtcars), n = 100)
#> # A tibble: 32 x 11 #> mpg cyl disp hp drat wt qsec vs am gear carb #> * <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 21.0 6.00 160 110 3.90 2.62 16.5 0 1.00 4.00 4.00 #> 2 21.0 6.00 160 110 3.90 2.88 17.0 0 1.00 4.00 4.00 #> 3 22.8 4.00 108 93.0 3.85 2.32 18.6 1.00 1.00 4.00 1.00 #> 4 21.4 6.00 258 110 3.08 3.22 19.4 1.00 0 3.00 1.00 #> 5 18.7 8.00 360 175 3.15 3.44 17.0 0 0 3.00 2.00 #> 6 18.1 6.00 225 105 2.76 3.46 20.2 1.00 0 3.00 1.00 #> 7 14.3 8.00 360 245 3.21 3.57 15.8 0 0 3.00 4.00 #> 8 24.4 4.00 147 62.0 3.69 3.19 20.0 1.00 0 4.00 2.00 #> 9 22.8 4.00 141 95.0 3.92 3.15 22.9 1.00 0 4.00 2.00 #> 10 19.2 6.00 168 123 3.92 3.44 18.3 1.00 0 4.00 4.00 #> 11 17.8 6.00 168 123 3.92 3.44 18.9 1.00 0 4.00 4.00 #> 12 16.4 8.00 276 180 3.07 4.07 17.4 0 0 3.00 3.00 #> 13 17.3 8.00 276 180 3.07 3.73 17.6 0 0 3.00 3.00 #> 14 15.2 8.00 276 180 3.07 3.78 18.0 0 0 3.00 3.00 #> 15 10.4 8.00 472 205 2.93 5.25 18.0 0 0 3.00 4.00 #> 16 10.4 8.00 460 215 3.00 5.42 17.8 0 0 3.00 4.00 #> 17 14.7 8.00 440 230 3.23 5.34 17.4 0 0 3.00 4.00 #> 18 32.4 4.00 78.7 66.0 4.08 2.20 19.5 1.00 1.00 4.00 1.00 #> 19 30.4 4.00 75.7 52.0 4.93 1.62 18.5 1.00 1.00 4.00 2.00 #> 20 33.9 4.00 71.1 65.0 4.22 1.84 19.9 1.00 1.00 4.00 1.00 #> 21 21.5 4.00 120 97.0 3.70 2.46 20.0 1.00 0 3.00 1.00 #> 22 15.5 8.00 318 150 2.76 3.52 16.9 0 0 3.00 2.00 #> 23 15.2 8.00 304 150 3.15 3.44 17.3 0 0 3.00 2.00 #> 24 13.3 8.00 350 245 3.73 3.84 15.4 0 0 3.00 4.00 #> 25 19.2 8.00 400 175 3.08 3.84 17.0 0 0 3.00 2.00 #> 26 27.3 4.00 79.0 66.0 4.08 1.94 18.9 1.00 1.00 4.00 1.00 #> 27 26.0 4.00 120 91.0 4.43 2.14 16.7 0 1.00 5.00 2.00 #> 28 30.4 4.00 95.1 113 3.77 1.51 16.9 1.00 1.00 5.00 2.00 #> 29 15.8 8.00 351 264 4.22 3.17 14.5 0 1.00 5.00 4.00 #> 30 19.7 6.00 145 175 3.62 2.77 15.5 0 1.00 5.00 6.00 #> 31 15.0 8.00 301 335 3.54 3.57 14.6 0 1.00 5.00 8.00 #> 32 21.4 4.00 121 109 4.11 2.78 18.6 1.00 1.00 4.00 2.00
if (!requireNamespace("nycflights13", quietly = TRUE)) stop("Please install the nycflights13 package to run the rest of this example") print(nycflights13::flights, n_extra = 2)
#> # A tibble: 336,776 x 19 #> year month day dep_time sched_dep_time dep_delay arr_time sched_arr_time #> <int> <int> <int> <int> <int> <dbl> <int> <int> #> 1 2013 1 1 517 515 2.00 830 819 #> 2 2013 1 1 533 529 4.00 850 830 #> 3 2013 1 1 542 540 2.00 923 850 #> 4 2013 1 1 544 545 -1.00 1004 1022 #> 5 2013 1 1 554 600 -6.00 812 837 #> 6 2013 1 1 554 558 -4.00 740 728 #> 7 2013 1 1 555 600 -5.00 913 854 #> 8 2013 1 1 557 600 -3.00 709 723 #> 9 2013 1 1 557 600 -3.00 838 846 #> 10 2013 1 1 558 600 -2.00 753 745 #> # ... with 336,766 more rows, and 11 more variables: arr_delay <dbl>, #> # carrier <chr>, …
print(nycflights13::flights, width = Inf)
#> # A tibble: 336,776 x 19 #> year month day dep_time sched_dep_time dep_delay arr_time sched_arr_time #> <int> <int> <int> <int> <int> <dbl> <int> <int> #> 1 2013 1 1 517 515 2.00 830 819 #> 2 2013 1 1 533 529 4.00 850 830 #> 3 2013 1 1 542 540 2.00 923 850 #> 4 2013 1 1 544 545 -1.00 1004 1022 #> 5 2013 1 1 554 600 -6.00 812 837 #> 6 2013 1 1 554 558 -4.00 740 728 #> 7 2013 1 1 555 600 -5.00 913 854 #> 8 2013 1 1 557 600 -3.00 709 723 #> 9 2013 1 1 557 600 -3.00 838 846 #> 10 2013 1 1 558 600 -2.00 753 745 #> arr_delay carrier flight tailnum origin dest air_time distance hour minute #> <dbl> <chr> <int> <chr> <chr> <chr> <dbl> <dbl> <dbl> <dbl> #> 1 11.0 UA 1545 N14228 EWR IAH 227 1400 5.00 15.0 #> 2 20.0 UA 1714 N24211 LGA IAH 227 1416 5.00 29.0 #> 3 33.0 AA 1141 N619AA JFK MIA 160 1089 5.00 40.0 #> 4 -18.0 B6 725 N804JB JFK BQN 183 1576 5.00 45.0 #> 5 -25.0 DL 461 N668DN LGA ATL 116 762 6.00 0 #> 6 12.0 UA 1696 N39463 EWR ORD 150 719 5.00 58.0 #> 7 19.0 B6 507 N516JB EWR FLL 158 1065 6.00 0 #> 8 -14.0 EV 5708 N829AS LGA IAD 53.0 229 6.00 0 #> 9 - 8.00 B6 79 N593JB JFK MCO 140 944 6.00 0 #> 10 8.00 AA 301 N3ALAA LGA ORD 138 733 6.00 0 #> time_hour #> <dttm> #> 1 2013-01-01 05:00:00 #> 2 2013-01-01 05:00:00 #> 3 2013-01-01 05:00:00 #> 4 2013-01-01 05:00:00 #> 5 2013-01-01 06:00:00 #> 6 2013-01-01 05:00:00 #> 7 2013-01-01 06:00:00 #> 8 2013-01-01 06:00:00 #> 9 2013-01-01 06:00:00 #> 10 2013-01-01 06:00:00 #> # ... with 336,766 more rows