header: Return the First Part of an Object

Description Usage Arguments Details Value Examples

Description

Returns the first parts of a vector, matrix, table, data frame or function. Since header() and h() are generic functions, they may also have been extended to other classes.

Usage

1
2
header(x, n = 10)
h(x, n = 10)

Arguments

x

an object

n

a single integer. If positive, size for the resulting object: number of elements for a vector (including lists), rows for a matrix or data frame or lines for a function. If negative, all but the n first number of elements of x.

Details

For matrices, 2-dim tables and data frames, head() (tail()) returns the first (last) n rows when n > 0 or all but the last (first) n rows when n < 0. head.matrix() and tail.matrix() are exported. For functions, the lines of the deparsed function are returned as character strings.

If a matrix has no row names, then tail() will add row names of the form [n,] to the result, so that it looks similar to the last lines of x when printed. Setting addrownums = FALSE suppresses this behaviour.

Value

An object (usually) like x but generally smaller. For ftable objects x, a transformed format(x).

Examples

1
2
3
4

mcanouil/myScriptsMickael documentation built on May 22, 2019, 12:59 p.m.