R utilities (functions)