Re: [R] Reimplement order somehow

2007-10-03 Thread XpeH
I have found how to reimplement order method from R language in PHP: $value) { $array_new[$key + 1] = $value; } $array = $array_new; print "\n --\n"; $uniq_arr = array_unique($array); ksort($uniq_arr); foreach ($array as $key => $value) { if ($key !== ($key +1)) { $array[$

Re: [R] Reimplement order somehow

2007-10-03 Thread Vladimir Eremeev
Vladimir Eremeev wrote: > > > XpeH wrote: >> >> I am trying to understand how the order method in R language works, and >> then I'd like to do the same in some other language. >> > > 1. Type order in R command prompt (without "(" and ")") and press enter. > This will print you the body of

Re: [R] Reimplement order somehow

2007-10-03 Thread Vladimir Eremeev
XpeH wrote: > > I am trying to understand how the order method in R language works, and > then I'd like to do the same in some other language. > 1. Type order in R command prompt (without "(" and ")") and press enter. This will print you the body of this function, so you can inspect it. You c

Re: [R] Reimplement order somehow

2007-10-03 Thread XpeH
Hello, Thierry Thank you for the fast reply actually my php script is not correct, the correct logic is R script, by writing this peace of code in php I tried to do the same logic that R script does. But this php programm algorirm probably is not correct so results are incorrect also. I am tryi

Re: [R] Reimplement order somehow

2007-10-03 Thread ONKELINX, Thierry
You're sorting characters in the PHP script instead of numbers! sort(as.character(o)) in R will yield the same results as you PHP script does. Thierry ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Res