updated r scripts