getting last 2 charcters of a string, other "text" functions?
Note that this one can be slightly simplified by using sub instead of gsub
(since you only will have one match anyways) and the $ is not needed
since .* will consume the maximal matching string:
sub(".*(..)", "\\1", mystring)
On 10/31/05, Carlos J. Gil Bellosta <cgb at datanalytics.com> wrote:
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
http://www.datanalytics.com
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
______________________________________________ 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