Skip to content
Prev 227453 / 398500 Next

reverse string

On Wed, 2010-07-14 at 12:13 +0200, Trafim Vanishek wrote:
[1] "cba"

If your real data is a vector of strings to reverse then

strings <- c("abc","abc","abc")
sapply(strsplit(strings, split = ""),
       function(str) {paste(rev(str), collapse = "")})

is one way to do this.

HTH

G