updated the r code for the changesets -- not quite right, but it works locally and i just need to speed up the query