R miscellaneous functions and examples