We present a study of J/psi and psi(2S) production in ppbar collisions, at sqrt s = 1.8 TeV with the CDF detector at Fermilab. The J/psi and psi(2S) mesons are reconstructed using their mu^+mu^- decay modes. We have measured the inclusive production cross section for both mesons as a function of their transverse momentum in the central region, |eta| < 0.6. We also measure the fraction of these events originating from b hadrons. We thus extract individual cross sections for J/psi and psi(2S) mesons from b-quark decays and prompt production. We find a large excess (approximately a factor of 50) of direct psi(2S) production compared with predictions from the color singlet model.