Show head and tail simultaneously

head_tail(data, n_slice = 6)

Arguments

data

The data frame to slice

n_slice

How many rows of the head and tail you want. Default is 6.

Value

A data frame of the first and last n_slice rows

Details

This will work on matrices and also not be limited to default tibble display.

Examples

library(tidyext) head_tail(mtcars)
#> index mpg cyl disp hp drat wt qsec vs am gear carb #> 1 1 21.0 6 160.0 110 3.90 2.620 16.46 0 1 4 4 #> 2 2 21.0 6 160.0 110 3.90 2.875 17.02 0 1 4 4 #> 3 3 22.8 4 108.0 93 3.85 2.320 18.61 1 1 4 1 #> 4 4 21.4 6 258.0 110 3.08 3.215 19.44 1 0 3 1 #> 5 5 18.7 8 360.0 175 3.15 3.440 17.02 0 0 3 2 #> 6 6 18.1 6 225.0 105 2.76 3.460 20.22 1 0 3 1 #> 7 27 26.0 4 120.3 91 4.43 2.140 16.70 0 1 5 2 #> 8 28 30.4 4 95.1 113 3.77 1.513 16.90 1 1 5 2 #> 9 29 15.8 8 351.0 264 4.22 3.170 14.50 0 1 5 4 #> 10 30 19.7 6 145.0 175 3.62 2.770 15.50 0 1 5 6 #> 11 31 15.0 8 301.0 335 3.54 3.570 14.60 0 1 5 8 #> 12 32 21.4 4 121.0 109 4.11 2.780 18.60 1 1 4 2