Basic knowledge of R.

.RData is an R file that contains data sets. You can read these data sets using load("~/filename/name.Rdata").

It is better to put the file that contains name.RData under the default R working directory which can be denoted as ~.

## To get the default working directory of R/RStudio

> getwd()


## Set working directory

> setwd('~/Dropbox/ARIC/PHENOTYPES/output')


> load("~/Dropbox/ARIC/PHENOTYPES/data/ARIC.RData")


The reason for choosing dropbox as sub-directory is that different people can run and edit code, as well as make outputs under “sharing folder” mode.

## Plot to pdf

> pdf(file="name.pdf")
> plot()  #can be many plots
> dev.off()


r: key words

## LaTex Template

\documentclass{article}

\begin{document}
...
\end{document}
Package for table to pdf in r

xtable - revert r table to LaTex codes

\documentclass{article}
\begin{document}

\begin{table}[ht]
\centering
\begin{tabular}{rrrrr}

\hline
& 1 & 2 & 3 & 4 \\
\hline
1 & 1 & 2 & 3 & 4 \\
2 & 5 & 6 & 7 & 8 \\
3 & 9 & 10 & 11 & 12 \\
\hline

\end{tabular}
\end{table}

\end{document}