The Mossbauer spectra of R2Fe14B, where R is La, Th, Dy, Ho and Lu, have been measured at 295 K and the Mossbauer spectra of R2Fe14C, where R is Nd, Ho and Gd, have been measured at various temperatures between 85 and 295 K. All of the resulting spectra have been successfully analyzed with the same model used earlier to fit the spectra of various related compounds. The results indicate that the weighted average hyperfine field increases uniformly from La to Gd and decreases uniformly from Gd to Lu in R2Fe14B, as was found earlier for R2Fe14C. The weighted average isomer shift decreases by 0.04 mm/s in going from La2Fe14B to Lu2Fe14B, because of a decrease in the unit cell volume and an increase of the number of electrons in the unit cell, a decrease which corresponds to a 13.5% increase in the electron density. The use of the same model for both the Nd, Gd, Tb, Dy, Ho and Lu borides and carbides permits a detailed comparison of the Mossbauer hyperfine parameters in the two series of compounds. There is a linear correlation of the hyperfine fields at each of the sites in these two series of compounds, indicating that the replacement of boron by carbon has a long-range effect on the magnetic exchange within these materials. There is a correlation of the isomer shifts of the 8j1, 8j2 and 16k2 sites in the two series of compounds. In contrast the isomer shift of the 16k1 site shows the chemical influence of replacing boron by carbon. With the expected exception of the 4c site there is a correlation between the quadrupole interactions in the two series of compounds. The Nd2Fe14B and Nd2Fe14C compounds have relatively low effective Mossbauer temperatures as compared to the borides and carbides with the heavier rare-earth elements.