Various R snippets