Magnetic properties of hexagonal RNi4B (R=Ce, Nd, Gd, Dy) compounds