I am trying get some R code to fit on my beamer slides. It does not seem possible to change the font size via the size argument for the code chunk as you might do f
Drawing on this tex.SE answer, we could redefine the Shaded environment that surrounds R code to make it footnotesize (and the verbatim environment for output). Add this to your header.txt:
%% change fontsize of R code
\let\oldShaded\Shaded
\let\endoldShaded\endShaded
\renewenvironment{Shaded}{\footnotesize\oldShaded}{\endoldShaded}
%% change fontsize of output
\let\oldverbatim\verbatim
\let\endoldverbatim\endverbatim
\renewenvironment{verbatim}{\footnotesize\oldverbatim}{\endoldverbatim}