add cleaned-up snippets for R

pushing cleaned up snippets based on SirVers comments regarding first PR. All of them are tested and work just as you would expect. Thanks for the hints, much cleaner now!