Learn R Programming

omnibus (version 1.2.15)

side: Left/right side of a data frame or matrix

Description

This function extracts the leftmost or rightmost set of columns of a data frame or matrix.

Usage

side(x, side = 1, n = 3)

Value

A data.frame or matrix.

Arguments

x

A data.frame or matrix.

side

Either 1 (left side) or 2 (right side), or 'left' or 'right'. Case is ignored and partial matching is used.

n

Number of columns. The default is 3.

See Also

corner, head, tail

Examples

Run this code

side(iris)
side(iris, 2)
side(iris, 'l')
side(iris, 'r')
side(iris, 1, 2)

Run the code above in your browser using DataLab