"t c" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I wish to obtain the right-most n characters of a character string?  What
is the appropriate function?

substr will work:

> x <- c("abcd", "xyz")

> N <- 2
> substr(x, nchar(x)-N+1, nchar(x))
[1] "cd" "yz"

> N <- 3
> substr(x, nchar(x)-N+1, nchar(x))
[1] "bcd" "xyz"

efg

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to