adding tutorial in R (Paulo's commented version)
Small fixes to tutorial in R, lots of fixes and additions to python
version.