Return the leftmost or rightmost columns of a matrix or dataframe

Return the leftmost or rightmost or columns of a matrix or dataframe

Keywords
manip
Usage
right(x, n = 6)
left(x, n=6)
Arguments
x

Matrix or dataframe

n

Number of columns to return

Value

An object consisting of the leftmost or rightmost n columns of x.

See Also

first, last, head, tail

Aliases
  • right
  • left
Examples
 m <- matrix( 1:100, ncol=10 )
 colnames(m) <- paste("Col",1:10, sep="_")
 left(m)
 right(m)

 d <- as.data.frame(m)
 left(d)
 right(d)
Documentation reproduced from package gdata, version 2.18.0, License: GPL-2

Community examples

Looks like there are no examples yet.