Fixed R for loop syntax

Fixed a syntax error in the snippet `for` for the language R, and added the missing `for` and `while` snippets to the `snippets/r.snippets` file.