factored out common R tasks run as 'root'