corner: Corner of a matrix or data frame

View source: R/corner.r

cornerR Documentation

Corner of a matrix or data frame

Description

Return a corner of a matrix or data frame (i.e., upper left, upper right, lower left, lower right).

Usage

corner(x, corner = 1, size = 5)

Arguments

x

Data frame or matrix.

corner

Integer in the set 1, 2, 3, 4 or character in the set 'topleft', 'topright', 'bottomleft', 'bottomright' or in the set 'tl', 'tr', 'bl', 'br'. Indicates which corner to return. Integers 1, 2, 3 and 4 correspond to top left, top right, bottom left, and bottom right corners. The default is 1, the top left corner.

size

Positive integer, number of rows and columns to return. If there are fewer columns/rows than indicated then all columns/rows are returned.

Value

A matrix or data frame.

See Also

head, tail

Examples

x <- matrix(1:120, ncol=12, nrow=10)
x
corner(x, 1)
corner(x, 2)
corner(x, 3)
corner(x, 4)

adamlilith/omnibus documentation built on April 12, 2024, 8:46 p.m.