[R] Insert R code in LaTeX document

From: Alexandre Depire <depire_at_gmail.com>
Date: Sun 17 Sep 2006 - 14:45:11 GMT


Hello,
i would like to insert R code in LaTeX document. I see something about the 'listings' package, but i would like if it is the best way and if it is possible to use the command \include{programme.R}. I have the following solution but it doesn't work with \include and \input



LaTex

main.tex



\documentclass{report}
\usepackage{listings}
\lstloadlanguages{R}

\begin{document}
\include{annexe}
\end{document}

annexe.tex



The code is:
\lstset{language=R}

#\include{} or \input or direct code ???

R code



# test
rm(list=ls())
x<-1:10
mean(x)

        [[alternative HTML version deleted]]



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Mon Sep 18 00:52:26 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Sun 17 Sep 2006 - 17:30:05 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.