General R tools