Useful R Code for reference