[R] getting last 2 charcters of a string, other "text" functions?

Carlos J. Gil Bellosta cgb at datanalytics.com
Mon Oct 31 16:52:00 CET 2005

gsub(".*(..)$", "\\1", "i only want the last two characters")

This is only a matter of finding the right regular expression. Use Google to
find a good tutorial on them.

Carlos J. Gil Bellosta

Quoting t c <quantpm at yahoo.com>:

> I wish to obtain the right-most n characters of a character string?  
> What is the appropriate function?
> ---------------------------------
> 	[[alternative HTML version deleted]]
> ______________________________________________
> R-help at 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

More information about the R-help mailing list