Practical information
Class dates
The V Modul will take place from 20th to 30th of April 2015
Exams
Coming soon
Contacts
Prof. Ebenhöh: oliver.ebenhoeh [AT] hhu.de
Resources
Material
BOOK: McKillup, Statistics Explained - An Introductory Guide for Life Scientists
BOOK: Popper, K. R. (1968) The Logic of Scientific Discovery . London: Hutchinson
BOOK: Popper, K. R. (1935) Logik der Forschung. Springer, Wien
BOOK: Jaynes, E. T. (2003) Probability Theory. Cambridge University Press. A somewhat different view on probability and statistics.
LaTeX and RStudio
Brief introduction to LaTeX
LaTeX is a language that allows you to create beautifully formatted text documents (.pdf or .ps) without too much effort. RStudio provides a good enough environment for writing LaTeX documents but if you want something specific to LaTeX you can check e.g. Kile.
The internet is full of tutorials to start with LaTeX, see e.g.
- http://en.wikibooks.org/wiki/LaTeX
- http://latex.tugraz.at/latex/tutorial
- http://www.latex-tutorial.com/tutorials/
You can of course copy-paste your R code in LaTeX (using e.g. the package listings for syntax formatting) and save graphics to include, but here the advantage is:
This enables the creation of dynamic reports that are updated automatically if data or analysis changes.
This means Sweave is very useful for "on going" projects, where things are expected to change, as well as quick notes on something you are working on.
Ref:
https://support.rstudio.com/hc/en-us/articles/200552056-Using-Sweave-and-knitr
LaTex in RStudio
First, install the knitr package:
> install.packages("knitr")
Set knitr as default for Rnw files: https://support.rstudio.com/hc/en-us/articles/200532247
Open a new file of type "R Sweave", it will automatically contain:
\documentclass{article}
\begin{document}
\end{document}
This is the basic of a LaTeX document. You can write something like:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{framed}
\usepackage{graphicx}
%\usepackage{hyperref}
%\usepackage[hdivide={2cm, *, 2cm}, vscale=0.85]{geometry}
%\usepackage[backend=bibtex]{biblatex}
%\usepackage{listings}
\title{Correlation analysis of the wildlings' deaths and the rise of white walkers}
\author{John Snow}
\date{}
\begin{document}
\maketitle
\section{Introduction}
\end{document}
save the file (the authomatic file extension will be .Rnw) and try to compile the file ("Compile PDF" button). You should be prompted a PDF: congratulations, this is your first LaTeX file!
Sweave
Readapting the file http://leisch.userweb.mwn.de/Sweave/example-1.Snw to work with knitr, we can add this example of including a plot in LaTeX from a R built-in dataframe:
\begin{figure}
<<boxplot, eval=TRUE, echo=FALSE>>=
boxplot(Ozone ~ Month, data = airquality)
@
\caption{This is some caption.\label{lab}}
\end{figure}
http://www.statistik.lmu.de/~leisch/Sweave/Sweave-manual.pdf
Links
Coming soon