# Adjusting the text width of R listings in LaTex [closed]

Hi I have R codes that I am listing in my LaTex file with

\begin{lstlisting}[language=R]

R code

\end{lstlisting}


I have no specific listing setting in my preamble. My R code is very wide and falls of the pages on the right side of the PDF file. How can I make sure that the width is the same as the text width of the whole file?

thanks in advance