R is an open source programming language and software environment for statistical computing and graphics. It is an implementation of the S programming language combined with lexical scoping semantics inspired by Scheme.

learn more… | top users | synonyms

88
votes
14answers
22k views

Workflow for converting LaTeX into Open Office / MS Word Format

I often have to write up reports based on the analysis of some data. I use R to analyse the data and export tables, figures, and text. This is then included into a LaTeX document either using input or ...
52
votes
7answers
21k views

How to draw Venn diagrams (especially: complements) in LaTeX

What I am up to is to write some exercises dealing with logical formulas for my students, like: And the students should draw these formulas on Venn diagrams. At the end of the lesson, I really ...
19
votes
2answers
6k views

How can I use a table generated by R in LaTeX?

I have a LaTeX table generated like this, \begin{table}[ht] \begin{center} \begin{tabular}{rrrrrrr} \hline & 1 & 2 & 3 & 4 & 5 & 6 \\ \hline 1 & 181.21 & 169.01 ...
13
votes
3answers
7k views

Using fancyhdr to create an image based header and footer

I'm trying to generate a latex report (via Sweave and R) where the header of the document is an image that covers everything (including the top/left/right page margin) and the footer covers everything ...
9
votes
4answers
2k views

knitr and biblatex

I'd like to create a PDF report with knitr with LaTeX-code in RStudio with biblatex for citations. However, the in-text-citations are always undefined and no bibliography is printed. The same ...
8
votes
1answer
309 views

proper tool for charts in tex

I have scanned data graphics in a large ms written in TeX (of course). For copyright reasons I need to redraw these. My publisher may (sadly) decide not to use my source directly, so will need access ...
8
votes
2answers
2k views

R, Sweave, Hmisc: pretty-print numbers

I'm creating a LaTeX tables based on a matrix in R using the 'latex' function of the Hmisc package. dat = matrix(c(1000, 100, 10000, 10000), 2) latex(dat, file='') This works (as expected) ...
9
votes
2answers
904 views

Building TeX file from knitr Rnw as child of larger parent TeX file to use R objects and output

Here's my general problem: I'm writing my dissertation using a LaTeX template (http://www.latextemplates.com/template/masters-doctoral-thesis). The template is a parent file with multiple chapters as ...
7
votes
1answer
311 views

Best Practice for nice layout with tikzDevice

R+tikDevice+LaTex+knitr is (as I understand it) the most efficient way to get relly nice looking publications from R, with maximum layout-support from LaTeX. I'm using R+LaTex+knitr now, but would ...
9
votes
3answers
1k views

Include Sweave input as verbatim

How do I keep Sweave from compiling things in a verbatim environment? For example: \documentclass{article} \begin{document} \begin{verbatim} <<>>= 1+1 @ \end{verbatim} \end{document} ...
5
votes
2answers
2k views

Wider tables in LaTeX, which is the best solution?

Hi I have a LaTeX table code generated from R like the following \usepackage{rotating} ... \begin{sidewaystable} \begin{center} \small\addtolength{\tabcolsep}{-7pt} ...
14
votes
2answers
5k views

How can I tell LaTeX that an \input file is in a different encoding from inputenc?

I'm currently writing a .tex report with my wife. She's on a Windows machine and I'm running Linux over here; we've decided to encode our report in ISO-8859-1 (i.e., we use ...
8
votes
2answers
920 views

Compiling latex directly from R

I want to find a programmatic way of converting a .tex latex document to pdf. What I usually do, and this works in most cases, is to use: tools::texi2dvi(latexfile, pdf = TRUE, clean = TRUE) ...
8
votes
1answer
857 views

Sweave generating invalid LaTeX

I've encountered a problem when I'm using Sweave to convert an .Rnw file into a .tex file. Sweave is replacing three options from hyperref's \hypersetup block with the value NA. This is the section ...
5
votes
2answers
2k views

Forcing roman font in LaTeX

I am using a LaTeX template from my university to typeset my thesis. I am making references to R and I have defined a new command with: \newcommand{\R}{R} in order to get the roman "R". The ...
3
votes
1answer
465 views

Problem in StatWeave

I visited http://www.stat.uiowa.edu/~rlenth/StatWeave/ and installed StatWeave according to the instructions. But my problem is that there are no Step by Step instructions given in the manual, and ...
8
votes
2answers
822 views

tikzDevice is not getting sizes right (knitr)

I am using OSX, pdflatex, R (cran), tikz/tikzDevice and knitr to create my documents. My problem is that the font sizes of the produced tikZ-file do not match the LaTeX document font sizes. Result / ...
1
vote
0answers
1k views

Fatal error occurred, no output PDF file produced in php file [closed]

We are using following code in .php script for generate .pdf file. $result1 = exec("R CMD Sweave /var/www/html/r/r_latex_sweave.Rnw"); $result2 = exec("pdflatex /var/www/html/r/r_latex_sweave.tex"); ...
19
votes
1answer
8k views

Getting Sweave code chunks to stay inside page margins?

Sometimes I get to make an R code chunk (in Sweave) which is longer then the margins of the page. Is there a way to force it to "go to the next line" once that happens? Here is a simple example of ...
8
votes
1answer
1k views

Automating Adding Tables Fast to LateX from R? [duplicate]

Possible Duplicate: How can I use a table generated by R in LaTeX? I use a lot of tables from R, and I find it cumbersome and very slow to type the "&" and "\" etc. to get the tables ...
6
votes
1answer
2k views

side-by-side xtables in Sweave

I use xtable to manage my tables in Sweave like this <<label=tab1, echo = FALSE, results = tex>>= print(xtable(Table1)) @ <<label=tab2, echo = FALSE, results = tex>>= ...
8
votes
1answer
882 views

Barchart with pgfplots with data from R

It took me a while to create a nice (... to some extent) bar chart with R which represents what I need. However I noticed it doesn't look very aesthetic in my Latex document. Sweave isn't a good ...
3
votes
3answers
5k views

How to include R output in LaTex? [duplicate]

I am not sure about how to include my r output in the best way in my latex document. Currently I saved my R output (NOT R CODE!) into a txt file: *---------------------------------* * GARCH ...
8
votes
5answers
2k views

How to get correct dimensions for a ggplot2 plot in beamer

I have a beamer presentation made with Sweave that I'm preparing and was wanting to place some ggplot2 graphs in but the aspect ratio does not seem to come out correct. This is what is in my Rnw ...
7
votes
1answer
974 views

How to build Knitr document from the command line

I would like to compile a knitr document from the command line. With Sweave, the sequence R CMD Sweave my_sweave_file.Rnw latex my_sweave_file.tex latex my_sweave_file.tex dvips my_sweave_file.dvi ...
5
votes
1answer
182 views

Best practice regarding graphics size

Whenever I make graphs from R to be included in Latex, I find myself scuttling back and forth between R to specify the size of the output and Latex to play with the \includegraphics[scale=??]. It ...
4
votes
1answer
842 views

Making LaTeX documents with Hebrew? (in Sweave + RStudio)

I would like to write in Hebrew in an .Rnw file, and use it with RStudio. Searching around, I found an example for using Hebrew in LaTeX in general: Numbers, punctuation and parenthesis reversed in ...
3
votes
1answer
2k views

Latex Error: 'Sweave.sty' not found?

I downloaded the most recent version of Miktex Basic Installer (2.9.5105). After following the Miktex's instructions, I began working through Nicola Satori's Sweave Tutorial. The R portion of ...
2
votes
2answers
519 views

Fedora manual installation and dependencies

Following answers on this website (like: How to use TeX Live on Fedora 17? and Manually installed TexLive on Fedora 16 ) I installed texlive manually on fedora and it works flawlessly. The problem I ...
0
votes
1answer
232 views

DB dump into LaTeX with Python and R?

I have quite a large index. I am planning to create a full-blown DB for it and later export the information to LaTeX. I am comfortable with R and Python so I would like to work with them but I feel ...
6
votes
1answer
146 views

How can I delete non-letter keywords (such as '<-')?

I am using the package to try and format my R code, and I don't like some of the things that are being treated as keywords (for the coloring scheme). However, when I specify deletekeywords={*,<-} ...
6
votes
1answer
110 views

Allow [ characters in tables without entering math-mode (from R)

I have R code that produces latex code like: \begin{tabular}{D{.}{.}{7}D{.}{.}{7}} \toprule \multicolumn{1}{c}{x} & \multicolumn{1}{c}{y} \\ \midrule [1, 5) & 1 \\ [1, 5) & 2 \\ [5, 8) ...
5
votes
3answers
354 views

import R data frame into org-mode table

I have an R script that generates a data frame, that I export to a CSV file. The data looks something like this: "","Variant","Xaxis","N","mean","sd","se" "1","line1",10,5,111.11,9.33,3.11 ...
4
votes
2answers
766 views

TikZ: Drawing the same data with scatter plots and parallel coordinates

I am new to TikZ and trying to recreate the following image (which was created in R): (Translation: correlation = +1, correlation = -1, two clusters, circle, normal distribution) Each "column" ...
3
votes
1answer
76 views

Vertical space only after every second row in a table

I have several tables in the following custom format, to which I would like to add vertical space (e.g. 6 pt) after every second row. I know this can be done manually. I am only wondering, if there is ...
3
votes
1answer
698 views

Latex listings R: need mono-spaced font with bold keywords and correct caret (^)

I am using the listings package to display R code. I would like a monospaced font, bold keywords, and I would like code that works when the user cuts and pastes from the pdf file into rstudio. The ...
2
votes
2answers
151 views

Double header in longtable

I'm trying to make a longtable and use some R tools for generating them. The problem is that when a long table has more than one columns, it creates double headers, as shown here: ...
2
votes
2answers
283 views

How to draw a graph by indicating volume of 3D elements but not their position

I have about five thousand observations which I would like to plot in a graph. Since the range of values is wide (from 1 to 108,000, with 90% of the observation taking a value of 2, 99% of the ...
2
votes
1answer
208 views

siunitx error: “invalid-number” from R

I have a document in .Rnw which I use to produce a .texdocument with kntir. I have a problem with the formula \num{\Sexpr{max(degree)}} which in R console produce 12598 but after the running knitr in ...
2
votes
1answer
326 views

Adding a knitr table from R into a \pgfplotstableread statement

I'm trying to get a table from R into a pgfplotstable to edit for printing. the r code is \documentclass{article} \usepackage{pgfplotstable} \begin{document} \pgfplotstableread[format=inline,row ...
2
votes
1answer
747 views

Sweave only produces NAs when using Umlauts.

I have a problem with Sweave. As soon as I use any mutated vowels/Umlauts (ü, ä, etc.) Sweave produces an NA in the document although it worked before. I don't know what to do, so any help would be ...