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

headtail(x, ...)

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

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

# S4 method for sparseMatrix
headtail(x, n = 2L, ascii = FALSE)

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

# S4 method for DataFrame
headtail(x, n = 2L, ascii = FALSE)

# S4 method for GRanges
headtail(x, n = 2L, ascii = FALSE)

# S4 method for SummarizedExperiment
headtail(x, n = 2L, ascii = FALSE)

Arguments

x

Object.

n

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

ascii

logical(1). Require separators to use ASCII instead of Unicode.

...

Additional arguments.

Value

Invisible NULL.

Details

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

Methods (by class)

  • atomic: Paste collapse to a character(1).

  • matrix: Show first and last rows.

  • sparseMatrix: Same method as matrix.

  • data.frame: Same method as matrix.

  • DataFrame: Same method as data.frame.

  • GRanges: Summarize the ranges.

  • SummarizedExperiment: Summarize the primary assay.

See also

Examples

data(rse, package = "acidtest") ## data.frame ==== headtail(datasets::mtcars, ascii = TRUE)
#> 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
headtail(dplyr::starwars)
#> name height │ vehicles starships #> 1 Luke Skywalker 172 │ <> <> #> 2 C-3PO 167 │ <> <> #> ─ ─ ─ ┼ ─ ─ #> 3 Captain Phasma <NA> │ <> <> #> 4 Padmé Amidala 165 │ <> <>
## SummarizedExperiment ==== headtail(rse, ascii = TRUE)
#> sample01 sample02 ... sample11 sample12 #> gene001 1 6 ... 1 1 #> gene002 30 32 ... 25 31 #> ... ... ... ... ... ... #> gene499 288 194 ... 74 139 #> gene500 3 15 ... 0 3