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

6
votes
1answer
345 views

Package to create TikZ Figures from R

I am wondering if there is a recommended package in order to create TikZ figures in R. In the paste I have used Matlab2TikZ to create TikZ figures in MATLAB - and I was hoping that there would be ...
-1
votes
1answer
1k views

Quality of R plots in LaTeX [closed]

In R, I use par to prepare four boxplots (using boxplot) as a single image, which I save with the png() command. This image is included in a LaTeX document with \includegraphics. I have experimented ...
1
vote
0answers
177 views

knitr : Figure are not appearing at the correct place [duplicate]

I'm trying to use knitr while learning LaTeX but all my figures are placed at a seemingly random place. It's driving me insane. Any ideas? Example Input PDF Output I tried reinstalling TeX Live ...
2
votes
1answer
95 views

How to put R code into a parameter of a newcommand?

I would like to put R code into a parameter of a newcommand in LaTeX. To do it, I make the following: %Define the newcommand: \newcommand\solution[1]{\sf #1} %Then, after the \begin{document}, I ...
3
votes
1answer
165 views

How to control latex appendix environment when placing R code in?

I am having a problem with latex environment. When I place r code using \begin{lstlisting} ... code..\end{lstlisting} other objects like tables are displayed only after the script subsections, despite ...
2
votes
0answers
102 views

Highlight R chunks in a Knitr document when working in Kile

When working on a knitr document in kile I can get highlights for the LaTeX parts of the document by adding the *.Rnw file extension in the Modes & Filetypes tab under Open/save configuration ...
0
votes
2answers
218 views

How to remove name while including image in LaTeX?

I am including an image in R and found the name of the image file appearing with the image: name<-c("A.pdf","B.pdf","C.pdf","D.pdf") <<echo=FALSE,results=tex>>= for (i in 1:4) ...
1
vote
2answers
234 views

Sweave documents: saving output for later use

I am fairly new to the idea of sweave documents. My document is a .Rnw file containing LaTeX code and R code. Part of my R code is computationally intensive and delays the compilation of my .Rnw ...
8
votes
1answer
309 views

Inconsistent output for R language operators when using listings package

A referee noticed that the <<- (assignment to a global) and %*% (matrix mult.) operators in a code listing I used were wrong. I am using the standard listings package (version 1.4 dated ...
2
votes
2answers
450 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 ...
3
votes
1answer
344 views

How use LaTeX counters to label knitr code chunks?

Imagine one has the LaTeX environments Example and Solution defined from the theorem environment. I have several Examples in numerous child documents which make up a book. LaTeX will automagically ...
2
votes
1answer
253 views

Bold font problem while using Russian fonts

This refers to my previous question not able to write bold characters using textbf I installed the cm-extra font package but still there is a problem with boldface due to ...
5
votes
1answer
205 views

Plot weighted frequency matrix

I wish to create this plot preferably in pgfplots or tikz. I have actually got a version plotted (with help from SO), but I have used R and exported the plot using tikzDevice. I can't post the ...
3
votes
2answers
693 views

Undesired quotes around values in table (pgfplot)

I am saving tables using write.table in R using the following code: x <- rnorm(100) y <- rnorm(100) z <- rnorm(100) model <- z ~ x + y results <- glm(model) pe <- ...
1
vote
1answer
136 views

Sweave: How to remove horizontal space in Soutput environments?

As the following example shows, there is a horizontal space added in the Soutput environment. This leads to a non-left-aligned output (see the output of rnorm(). I found that this space already exists ...
2
votes
1answer
306 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 ...
5
votes
1answer
469 views

How to randomize content with examdesign package using Sweave

Forgive me in advance if this is a dumb question, or too specific to one package. I've been using examdesign to randomize the order of questions, but I also want to randomly generate the content. I've ...
4
votes
1answer
224 views

Align Numeric Values from knitr command \Sexpr{} by Decimal in Table

How can I align numeric values brought in from the knitr command \Sexpr{} by decimal in a table?
2
votes
1answer
464 views

Program Tikz in Beamer

The attached .Rnw-code produces two similar slides, but with different texts and different arrow positions. I wrote both slides manually, but because I need to produce hundreds of similar slides, I ...
3
votes
1answer
598 views

Making a LaTeX text R logo. How maintain the proportions?

I tried to mimic the R logo in jpg format from R site only with LaTeX in order to make it scalable with the context without external files. This is the result at tiny, normal and huge size, compared ...
3
votes
1answer
292 views

LaTeX “command” /incantation for R

I am using the tufte-handout class in LaTeX and I want to refer to R using the "correct" sans-serif font. I am currently using \newcommand{\R}{ {\bf \sffamily R } } used as ... ... function in ...
4
votes
2answers
699 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" ...
5
votes
2answers
1k 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 ...
7
votes
4answers
1k 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 ...
0
votes
1answer
123 views

Question mark in knitr code getting quote marks [closed]

I'm trying to use question marks in a code block using knitr, but in the compiled pdf always puts quotes around it, so, for example <<helpCode, eval=FALSE>>= ?rnorm @ comes out as ...
1
vote
1answer
959 views

exporting R ggplot2 plots to LaTex

I usually export ggplot2 plots from R using "Save As" PDF and works fine, then I use \includegraphics from LaTex to include the fig. The problem is that it seems that the amount of data in these ...
1
vote
1answer
246 views

How to obtain Sweave(l) listings with rounded corners?

I downloaded the Sweavel.sty-File from here: http://biostat.mc.vanderbilt.edu/wiki/pub/Main/SweaveTemplate/Sweavel.sty Now, for a modern look, I would like to produce rounded corners in the R code ...
4
votes
1answer
388 views

number separator formatting with ragged right positioning using siunitx, R, Hmisc::latex

I found Boris's suggestion to use siunitx to achieve number formatting in Hmisc::latex tables to almost be exactly what I was looking for: R, Sweave, Hmisc: pretty-print numbers However, if you look ...
1
vote
0answers
316 views

R: Prettify xtable() output for printing a matrix or dataframe [closed]

Following a suggestion, this is a repost from stackoverflow. I am trying to print out this table from R using xtable(). The default output is ugly. Is it possible to embed latex code within xtable() ...
3
votes
1answer
410 views

R listings operator partially in bold

I am using listings to display R code. The matrix multiplication operator shows up partially bold, something like this: "\%\textbf{*\%}". If I separate the * and the %, the second % is not in bold. I ...
5
votes
1answer
121 views

Sweave Float environment over 2 pages

I have a bit of Sweave code as such: <<label = Example1, echo= true>>= //Bunch of R Code @ I've tried putting it in my own float environment like so \newfloat{rcode}{h!}{rcode} ...
5
votes
2answers
318 views

How to label a code section in Sweave

I'm new to sweave and was wondering what is the appropriate way to label a code section. For example, if I have: <<echo= true>>= x<-5 y<-x+5 @ How would I get it to put a either ...
3
votes
1answer
642 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 ...
9
votes
1answer
1k views

R+LaTex to HTML5 better than pdf?

I use R together with ggmap, ggplot2, Rstudio, knitr, and beamer to produce presentations in pdf. Soon I hope to have time to learn TikZ too. I have not moved to Markdown because I appreciate the ...
3
votes
1answer
2k views

How to print a LaTeX matrix using xtable in R

I'm trying to get R to print a matrix as a LaTeX matrix using xtable, using the LaTeX environment bmatrix. a <- matrix(rnorm(25), 5 ,5) x <- xtable(x) > print(x, floating=FALSE, ...
10
votes
2answers
1k views

How to Insert into Latex a Text File whose name is a variable?

I need to insert a text file into LaTeX. But text file names are different for different projects. So I want to define text file name as a variable and refer to the variable when inserting the text I ...
1
vote
1answer
187 views

Explain Soutput Schunk -block when switched from article to scrreprt

When I zwitched from article to \documentclass[fontsize=2pt]{scrreprt}, I am getting around the xtable -things: \begin{Schunk} \begin{Soutput} ... \end{Schunk} \end{Soutput} Trial (code here) $ R ...
6
votes
6answers
1k views

How to comment in an R-chunk?

I'm quite new to both R and LaTeX, but I'm trying to work with both, using Sweave. I know you can comment in R using # and in LaTeX by using %. However, when I write a #comment in an R-chunk (between ...
0
votes
1answer
968 views

How to disable null device while usin dev.off() in R and latex?

How to disable message null device when using R and latex. <<echo=FALSE ,results=tex>>= data<-read.table("test",sep="\t",header=TRUE,check.names=FALSE) ...
8
votes
3answers
3k views

LaTeX techniques and templates for writing a book [closed]

I am about to write a couple of books using LaTeX. I am fairly used to producing small LaTeX articles using Sweave and R, but I have never written a book using LaTeX and I am not conversant with the ...
2
votes
1answer
858 views

Reducing R figure sizes in lyx?

I am using LyX with the Sweave module to generate some R figures within a document. I can't seem to get the figures to be smaller, and they tend to take up half a page which is far too large. I have ...
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) ...
4
votes
1answer
778 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 ...
15
votes
3answers
2k views

Filling a full beamer slide with tikzDevice output from R

Q: What's the best way to fill an entire beamer slide with tikzDevice output (i.e., the .tex file output from the tikz() function in R's tikzDevice package)? I've included some undesirable examples ...
2
votes
2answers
2k views

Missing character: There is no ? in font cmr12!

I'm not quite sure how to diagnose this issue. This is what I see in my log file. However, there are no "?" symbols in my work. FWIW, Here's my preamble: \documentclass[12pt]{article} ...
13
votes
2answers
4k 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 ...
2
votes
1answer
392 views

pgfSweave() results in texi2dvi error “Missing \endcsname inserted”

When running pgfSweave using a file with the following sample code: \documentclass[letter]{article} \begin{document} In this example we embed parts of the examples from the \texttt{kruskal.test} ...
3
votes
1answer
669 views

Using tabularx package with xtable package in R

I am trying to solve the problem of having a latex table (produced using the xtable from R, then combined into a tex file using Sweave), exceeding the margins of my LaTeX document. I found that one ...
18
votes
2answers
936 views

Repeated slides in beamer

I have about 200 JPEG files that I need to include in a PDF document, one JPEG per page (i.e. 200 pages + intro slide). The following code successfully does this with one JPEG. ...
4
votes
1answer
324 views

Using listings for R code with ## in rangeprefix

In R, comments are preceded by the symbol #. Moreover, to avoid messing with the indentation, it's usually ## instead of #. Therefore, as I want to include some R code in a LaTeX document, I am using ...