Useful R scripts