StrLeft, StrRight | R Documentation |
Returns the left part or the right part of a string. The number of characters are defined by the argument n
.
If n
is negative, this number of characters will be cut off from the other side.
StrLeft(x, n)
StrRight(x, n)
x |
a vector of strings. |
n |
a positive or a negative integer, the number of characters to cut. If n is negative, this number of characters will be cut off
from the right with |
The functions StrLeft
and StrRight
are simple wrappers to substr
.
the left (right) n characters of x
Andri Signorell <andri@signorell.net>
substr
, StrTrim
StrLeft("Hello world!", n=5)
StrLeft("Hello world!", n=-5)
StrRight("Hello world!", n=6)
StrRight("Hello world!", n=-6)
StrLeft(c("Lorem", "ipsum", "dolor","sit","amet"), n=2)
StrRight(c("Lorem", "ipsum", "dolor","sit","amet"), n=c(2,3))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.