By default, LaTex tables are very tight: \usepackage{booktabs} \begin{table}[] \centering \caption{My caption} \label{my-label} \begin{tabular}{@{}lll@{}} \toprule Rows & Column 1 & Column 2 \\ \midrule Row 1 & 1234 & 2345 \\ Row 2 & 3456 & 4567 \\ Row 3 & 5678 & 6789 \\ Row 4 & 7890 & 8901 \\ Row 5 & 9012 & 10000 \\ \bottomrule \end{tabular} \end{table} Adding this to the document preamble will add space between the rows:

Continue reading

My minimal example: \documentclass[a4paper]{article} %%% FIGURES AND TABLES %%%% \usepackage{graphicx} %gives the \includegraphics[width=0.5\textwidth]{my_image} %%% PAGE AND TEXT SET-UP %%%% \usepackage{fullpage} %gets rids of the wide default borders \renewcommand{\baselinestretch}{1.5} %space between lines \begin{document} Hello hello hello \end{document} And then one that is not so minimal, but still pretty basic and useful: \documentclass[a4paper]{article} %%% FIGURES AND TABLES %%%% \usepackage{graphicx} %gives the \includegraphics[width=0.5\textwidth]{my_image} \usepackage{booktabs} %for nicer tables \usepackage{tabu} %advanced control over tables \renewcommand{\thetable}{S\arabic{table}} %if this is supplement (this numbers figures as S1, S2.

Continue reading

One picture says more than a thousand words. You have what is one the left, and you want what is on the right. my_matrix = matrix(c(1, 2, 3, 4, 5, 6, 7, 8, 9), nrow=3) #matrix is a 2D array, this next row creates a third dimension, #duplicating the data my_array = array(my_matrix, dim = c(3,3,2)) There are a few different ways to do this, but by far the cleanest and quickest way is to just select the rows and columns multiple times, by replicating row and column numbers (instead of actually replicating each element):

Continue reading

Install Pandoc: http://pandoc.org/ library(knitr) knit('report.Rmd') #This creates 'report.md' Open the Terminal, Command Prompt (search for cmd) or Windows Powershell, go to the folder and do: pandoc -s report.md -o report.tex And that’s it! (Read this, if you want vector images.)

Continue reading

I’ve recently started using ggplot2 in addition to lattice (see this post that I made a while ago, explaining how I got into using lattice in the first place). Hint: when using ggplot2, you’ll need to use of the reshape2 package (also written by the amazing Hadley Wickham) to get your data into a form that ggplot2 works best with. Another thing that you’ll want to think about when using ggplo2 is factor levels.

Continue reading

Author's picture

Riinu Ots

if it aint broke, you’re outdated

Data Manager

Edinburgh, UK