Return the first and last parts of an object
Source:R/AllGenerics.R
, R/headtail-methods.R
headtail.Rd
Applies to both rows and columns, enabling quick inspection during interactive use.
Usage
headtail(x, ...)
# S4 method for class 'data.frame'
headtail(x, n = 2L)
# S4 method for class 'list'
headtail(x, n = 2L)
# S4 method for class 'matrix'
headtail(x, n = 2L)
# S4 method for class 'vector'
headtail(x, n = 2L)
Functions
headtail(data.frame)
: Same method asmatrix
.headtail(list)
: Paste collapse to acharacter(1)
.headtail(matrix)
: Show first and last rows.
Examples
data(mtcars, package = "datasets")
## atomic ====
headtail(LETTERS)
#> [1] "A B ... Y Z"
## data.frame ====
headtail(mtcars)
#> [1] " mpg cyl ... gear carb"
#> [2] "Mazda RX4 21 6 ... 4 4"
#> [3] "Mazda RX4 Wag 21 6 ... 4 4"
#> [4] "... ... ... ... ... ..."
#> [5] "Maserati Bora 15 8 ... 5 8"
#> [6] "Volvo 142E 21.4 4 ... 4 2"