updating compute_R method