R: query and update data structure version