StrRight.Rd
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)
The functions StrLeft
and StrRight
are simple wrappers to substr
.
the left (right) n characters of x
StrLeft("Hello world!", n=5)
#> [1] "Hello"
StrLeft("Hello world!", n=-5)
#> [1] "Hello w"
StrRight("Hello world!", n=6)
#> [1] "world!"
StrRight("Hello world!", n=-6)
#> [1] "world!"
StrLeft(c("Lorem", "ipsum", "dolor","sit","amet"), n=2)
#> [1] "Lo" "ip" "do" "si" "am"
StrRight(c("Lorem", "ipsum", "dolor","sit","amet"), n=c(2,3))
#> [1] "em" "sum" "or" "sit" "et"