On Wed, Jul 14, 2010 at 6:13 AM, Trafim Vanishek <rdapam...@gmail.com> 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 this:

> DF <- data.frame(month = month.abb)
> library(sqldf)
> sqldf("select reverse(month) from DF")
   reverse(month)
1             naJ
2             beF
3             raM
4             rpA
5             yaM
6             nuJ
7             luJ
8             guA
9             peS
10            tcO
11            voN
12            ceD

______________________________________________
R-help@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.

Reply via email to