Cosmological perfect-fluids in f (R) gravity