On Sun, Oct 11, 2009 at 12:53 PM, Gabor Grothendieck
<ggrothendi...@gmail.com> wrote:
> Try this:
>
>> library(tcltk)
>> as.numeric(tcl("string", "reverse", 123))
> [1] 321

The bit where the original poster said 'unknown length' worried me:

 > as.numeric(tcl("string", "reverse", 12377656534))
[1] 0.4356568

 > as.numeric(paste(rev(strsplit(as.character(1234567890123727723),"")[[1]]),collapse=""))
[1] 6.167273e+18

As well as the use of the word 'number' - both solutions give NA for
negative integers and various things for decimals...

Just a bit of Sunday morning pedantry for you :)

Barry

______________________________________________
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