Re: [R] replace last 3 characters of string

From: Dieter Menne <dieter.menne_at_menne-biomed.de>
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.

Dieter

--
View this message in context: http://r.789695.n4.nabble.com/replace-last-3-characters-of-string-tp3424354p3425855.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
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 https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive