Magnetic and spectral studies of Er2BaNiO5 and other rare earth nickelates