Loop Through Object Javascript And Change Values In R