Some R scripts and fucntions for fun