add cleaned-up snippets for R