Hole and Electron Doping of RNiO3 (R = La, Nd)