[R] How do I reverse the digits of a number
Ben Bolker
bolker at ufl.edu
Sun Oct 11 03:42:52 CEST 2009
tom_p wrote:
>
> Hi All,
>
> Thanks for your help. I need to reverse the digits of a number (unknown
> lenght). Example 1234->4321
>
> Tom
>
> z <- 4321
> as.numeric(paste(rev(strsplit(as.character(z),"")[[1]]),collapse=""))
[1] 1234
--
View this message in context: http://www.nabble.com/How-do-I-reverse-the-digits-of-a-number-tp25838410p25840085.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list