headtail: Return the first and last parts of an object

headtailR Documentation

Return the first and last parts of an object

Description

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

Usage

headtail(x, ...)

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

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

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

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

Arguments

x

Object.

n

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

...

Additional arguments.

Details

Inspired by the print method for DataFrame class.

Value

character.

Functions

  • headtail(data.frame): Same method as matrix.

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

  • headtail(matrix): Show first and last rows.

Note

Updated 2023-09-20.

See Also

  • utils::head(), utils::tail().

  • cat().

Examples

data(mtcars, package = "datasets")

## atomic ====
headtail(LETTERS)

## data.frame ====
headtail(mtcars)

acidgenomics/r-acidbase documentation built on Jan. 12, 2024, 3:56 a.m.