head
Get the First or Last Part of an Object

Description

Returns either the first (head) or last (tail) parts of a vector, matrix, data frame, table or function.

Usage

head(x, ...)
tail(x, ...)

Arguments

x an object.
... additional arguments passed to the head or tail method.

Details

head and tail return (respectively) the first or last n elements of a vector, rows of a data frame or matrix, or lines of a function. Additional arguments can include an integer, n, specifying the following:
Value
returns an object of roughly the same type of the input object x if x is not a function. If x is a function, the returned value is a vector of strings that have line numbers at the beginning of each string.
See Also
format, sprintf.
Examples
head(objects())
head(matrix(1:16,4), n=2)
head(data.frame(x=1:10,y=101:110), n=-3)
tail(matrix(1:16,4), n=2)
tail(data.frame(x=1:10,y=101:110), n=-3)
Package utils version 4.0.0-28
Package Index