R Programming code for various geological applications