combined R snippets into one post