Miscellaneous R exercises