scaleable r scripts