Sweave and Xtable combining R analysis and LaTeX typesetting Lars - - PowerPoint PPT Presentation
Sweave and Xtable combining R analysis and LaTeX typesetting Lars - - PowerPoint PPT Presentation
Sweave and Xtable combining R analysis and LaTeX typesetting Lars Nilse Tbingen University separate R analysis and LaTeX typeseting *.R raw data 16 14 12 10 y 8 6 4 5 10 15 20 25 x analysed
separate R analysis and LaTeX typeseting *.R
- 5
raw data analysed data (tables, plots)
separate R analysis and LaTeX typeseting *.R
- 5
*.tex
raw data analysed data (tables, plots)
! ! ! ! ! ! ! 5 10 15 20 25 4 6 8 10 12 14 16 x y Figure 1: simple scatter plot Data Analysis The data of file data20110113.csv are listed in Tab. 1 and plotted in Fig. 1. The average x is 8.8571. V1 V2 1 1 6 2 2 7 3 3 3 4 6 12 5 9 14 6 16 14 7 25 16 Table 1: data from filefinal report
Sweave script *.Snw
raw data
! ! ! ! ! ! ! 5 10 15 20 25 4 6 8 10 12 14 16 x y Figure 1: simple scatter plot Data Analysis The data of file data20110113.csv are listed in Tab. 1 and plotted in Fig. 1. The average x is 8.8571. V1 V2 1 1 6 2 2 7 3 3 3 4 6 12 5 9 14 6 16 14 7 25 16 Table 1: data from filefinal report
*.Snw = *.tex with embedded *.R
<< ... >> some R code @
\Sexpr{ some R expression }
generating tables using Xtable
embedding plots
5 10 15 20 25 4 6 8 10 12 14 16 x y
Figure 1: simple scatter plot
Data Analysis
The data of file data20110113.csv are listed in Tab. 1 and plotted in Fig. 1. The average x is 8.8571. V1 V2 1 1 6 2 2 7 3 3 3 4 6 12 5 9 14 6 16 14 7 25 16 Table 1: data from file
snw2pdf.sh
snw2pdf.sh
data20110113.csv template.Snw
snw2pdf.sh
data20110113.csv template.Snw data20110113.Snw
snw2pdf.sh
data20110113.csv template.Snw data20110113.Snw data20110113.tex
snw2pdf.sh
data20110113.csv template.Snw data20110113.Snw data20110113.tex data20100113.pdf
Sweave links
- Sweave homepage
http://www.stat.uni-muenchen.de/~leisch/Sweave/
- Sweave example
http://bit.ly/hkkyyb