Re: [R] reverse string

2010-07-14 Thread Gabor Grothendieck
On Wed, Jul 14, 2010 at 6:13 AM, Trafim Vanishek wrote: > Dear all, > > Are there any functions in R to reverse the order of the string. > smth like reverse("abc") to get "cba"? > Suppose data.frame DF has a column for which we wish to reverse each component. Then using the builtin month.abb try

Re: [R] reverse string

2010-07-14 Thread Petr PIKAL
Hi Quick glance to strsplit help page strReverse <- function(x) sapply(lapply(strsplit(x, NULL), rev), paste, collapse="") Regards Petr r-help-boun...@r-project.org napsal dne 14.07.2010 12:36:12: > On Wed, 2010-07-14 at 12:13 +0200, Trafim Vanishek wrote: > > Dear all, > > > > Are there a

Re: [R] reverse string

2010-07-14 Thread Gavin Simpson
On Wed, 2010-07-14 at 12:13 +0200, Trafim Vanishek wrote: > Dear all, > > Are there any functions in R to reverse the order of the string. > smth like reverse("abc") to get "cba"? > paste(rev(strsplit("abc", split = "")[[1]]), collapse = "") [1] "cba" If your real data is a vector of strings to

Re: [R] reverse string

2010-07-14 Thread Martyn Byng
project.org] On Behalf Of Trafim Vanishek Sent: 14 July 2010 11:13 To: r-help@r-project.org Subject: [R] reverse string Dear all, Are there any functions in R to reverse the order of the string. smth like reverse("abc") to get "cba"? Thanks a lot

[R] reverse string

2010-07-14 Thread Trafim Vanishek
Dear all, Are there any functions in R to reverse the order of the string. smth like reverse("abc") to get "cba"? Thanks a lot. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-h