StatWeave is an external tool for including statistical code (from a variety of common statistical packages, including R, Stata, and SAS) into both LaTeX and OpenOffice Documents.
StatWeave allows you to weave together LaTeX code and statistical package code in a single document so that your statistics package runs the code, and the Statweave program embeds the output (and the source code if desired) into your document.
StatWeave is available here: StatWeave Web Page.
A related system is Sweave.
One big difference between StatWeave and Sweave is that Sweave is designed only for R, whereas StatWeave is able to handle code from a variety of statistical and mathematical packages including R, Stata, SAS, Maple, Mathematica etc.