Applies to both rows and columns, enabling quick inspection during interactive use.

headtail(x, ...)

# S4 method for list
headtail(x, n = 2L)

# S4 method for vector
headtail(x, n = 2L)

# S4 method for matrix
headtail(x, n = 2L)

# S4 method for data.frame
headtail(x, n = 2L)

Arguments

x

Object.

n

integer(1). Positive integer denoting the number of first and last items to include.

...

Additional arguments.

Value

Invisible NULL.

Details

Inspired by the print() method for DataFrame class objects.

Functions

  • headtail,list-method: Paste collapse to a character(1).

  • headtail,matrix-method: Show first and last rows.

  • headtail,data.frame-method: Same method as matrix.

Note

Updated 2020-10-07.

See also

Examples

data(mtcars, package = "datasets") ## data.frame ==== headtail(mtcars)
#> mpg cyl ... gear carb #> Mazda RX4 21 6 ... 4 4 #> Mazda RX4 Wag 21 6 ... 4 4 #> ... ... ... ... ... ... #> Maserati Bora 15 8 ... 5 8 #> Volvo 142E 21.4 4 ... 4 2