Re: [R] replace last 3 characters of string

From: Dieter Menne <>
Date: Mon, 04 Apr 2011 10:41:30 -0500 (CDT)

Bert Jacobs-2 wrote:
> I would like to replace the last tree characters of the values of a
> certain
> column in a dataframe.

Besides the mentioned standard method: I found the subset of string operations in Hadley Wickhams stringr package helpful. They have a much more consistent interface compared to the standard interface.

str_sub: accepts negative positions, which are calculated from the left of the last character.


View this message in context:
Sent from the R help mailing list archive at

______________________________________________ mailing list
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.
Received on Mon 04 Apr 2011 - 15:44:12 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 04 Apr 2011 - 15:50:26 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive