left: Left- or right-most element(s)

Description Usage Arguments Value Author(s) See Also Examples

Description

Extract the n left-most (left) or right-most (right) elements of x.

Usage

1
2
3
left(x, n = 1)

right(x, n = 1)

Arguments

x

a vector that you wish to extract from.

n

an optional integer indicating the number of elements you wish to extract from x starting from the left-most (left) or right-most (right) element.

Value

A character vector containing the n left-most (left) or right-most (right) elements of x.

Author(s)

Gerhard Nachtmann kpm.nachtmann@gmail.com

See Also

substr, nchar

Examples

1
2
3
4
5
  x <- c("abcde", "12345")
  left(x)
  left(x, n = 3)
  right(x)
  right(x, n = 2)

nachti/STATtools documentation built on May 23, 2019, 12:04 p.m.