R code
This code is not the last version that i used for my tests. The last version is 3.0, i will try to update it as soon as possible.
If you use this version and find some anomalies, please contact me on my email or my website (www.dmzakaria.com).