sweave and xtable
play

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


  1. Sweave and Xtable combining R analysis and LaTeX typesetting Lars Nilse Tübingen University

  2. separate R analysis and LaTeX typeseting *.R raw data 16 ● 14 ● ● 12 ● 10 y 8 ● 6 ● 4 ● 5 10 15 20 25 x analysed data (tables, plots)

  3. separate R analysis and LaTeX typeseting *.R raw data 16 ● 14 ● ● 12 ● 10 y 8 16 ! ● 14 ! ! 6 ● 12 ! 10 4 y ● 8 ! 6 ! 5 10 15 20 25 4 *.tex ! x 5 10 15 20 25 x analysed data Figure 1: simple scatter plot Data Analysis (tables, plots) 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 final report

  4. Sweave script 16 ! 14 ! ! 12 ! 10 y 8 ! 6 ! 4 ! *.Snw 5 10 15 20 25 x 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 raw data 5 9 14 6 16 14 7 25 16 Table 1: data from file final report

  5. *.Snw = *.tex with embedded *.R

  6. << ... >> some R code @

  7. \Sexpr{ some R expression }

  8. generating tables using Xtable

  9. embedding plots

  10. 16 ! 14 ! ! 12 ! 10 y 8 ! 6 ! 4 ! 5 10 15 20 25 x 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

  11. snw2pdf.sh

  12. snw2pdf.sh data20110113.csv template.Snw

  13. snw2pdf.sh data20110113.csv template.Snw data20110113.Snw

  14. snw2pdf.sh data20110113.csv template.Snw data20110113.Snw data20110113.tex

  15. snw2pdf.sh data20110113.csv template.Snw data20110113.Snw data20110113.tex data20100113.pdf

  16. Sweave links • Sweave homepage http://www.stat.uni-muenchen.de/~leisch/Sweave/ • Sweave example http://bit.ly/hkkyyb

More recommend