Exporting R tables in LaTeX

Recently I have started using LaTeX for all my documents and presentations. Don’t ask me why, I just like how texts look there rather than in products of Microsoft (and I in general dislike MS… we have a long unpleasant history). So, I sometimes need to export tables from R into LaTeX. These tables can be huge, so exporting them manually is not an option. I know that there are R packages for this (probably, R has packages for everything in this world), however I prefer simpler methods. So what I usually do is just use write.table() function:

As a result that matrix is saved in “ourTable.txt” file:

and it can be easily copy-pasted into desired LaTeX file. The only thing that needs to be done after that – is correction of column names with additional “&” before “Col1”.

Leave a Reply