We study the classical and quantum models of a Friedmann-Robertson-Walker (FRW) cosmology, coupled to a perfect fluid, in the context of the f (R) gravity. Using the Schutz' representation for the perfect fluid, we show that, under a particular gauge choice, it may lead to the identification of a time-parameter for the corresponding dynamical system. Moreover, this formalism gives rise to a Schrödinger-Wheeler-DeWitt (SWD) equation for the quantum-mechanical description of the model under consideration, the eigenfunctions of which can be used to construct the wavefunction of the Universe. In the case of f (R) = R 2 (pure quadratic model), for some particular choices of the perfect fluid source, exact solutions to the SWD equation can be obtained and the corresponding results are compared to the usual f (R) = R model.