addingRcode

for comparison with python way