'How to resize an R code output on Beamer Latex

I would like to resize my R code output on Beamer Latex. I have something like :

\begin{frame}[fragile]
\frametitle{Application du modèle : contenu de lung}

<<echo=FALSE>>=
library(survival)
attach(lung)
head(lung)
@

\textbf{\underline{Objectif:}} construire un modèle qui vérifie les hypothèses de Cox 
à partir de ce jeu de données
\end{frame}

The problem is that the output table protrudes from the slide. Thanks.

Edit : also when i try to compile this part of code

\begin{frame}{Premier modèle naïf}
<<echo=FALSE, linebreaks=TRUE>>=
library(survival)
model_1<-coxph(Surv(time,status) ~ age+factor(sex)+ph.ecog+wt.loss, data = lung)
cox.zph(model_1)
@
\textbf{\underline{Objectif:}} construire un modèle qui vérifie les hypothèses de Cox à partir de ce jeu de données
\end{frame}

It looks like :

Problem



Solution 1:[1]

Internally this kniter thingy seems wrap the code in a custom environment called kframe. You can change the font size for this environment like this:

\documentclass{beamer}

\AtBeginEnvironment{kframe}{\tiny}

\begin{document}

\begin{frame}[fragile]
\frametitle{Application du modèle : contenu de lung}

<<echo=FALSE>>=
library(survival)
attach(lung)
head(lung)
@

\textbf{\underline{Objectif:}} construire un modèle qui vérifie les hypothèses de Cox 
à partir de ce jeu de données
\end{frame}

\end{document}

enter image description here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 samcarter_is_at_topanswers.xyz