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

2
votes
1answer
477 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 ...
4
votes
1answer
692 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 ...
4
votes
1answer
371 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
785 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
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 ...
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 ...
0
votes
1answer
146 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
1k 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
270 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
430 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
332 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
473 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
134 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
366 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
713 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 ...
4
votes
1answer
3k 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
223 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
2k 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
1k 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
1k 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
862 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
3k 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} ...
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 ...
2
votes
1answer
439 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
768 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
1k 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
333 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 ...
3
votes
3answers
865 views

Table Limit: Sweave

I'm running into an issue. It seems that when I try to output more than 17 or 18 tables to a pdf document the remaining tables are ignored. When I split them across multiple Rnw files, there is no ...
13
votes
3answers
8k 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 ...
20
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 ...
2
votes
1answer
1k views

Caption for longtable in Sweave

I'm using the following code in .Rnw file to generate a longtable <<label = tabggplot2df, echo = FALSE, results = tex >>= print( xtable( x = ggplot2df , caption = ...
0
votes
1answer
164 views

Making extra produced schunk globally invisible in Sweave

I'm using ASREML-R for data analysis. When I fit the model in ASREML-R, it produces some information regarding the model like this dat <- data.frame(y=rnorm(20),x=seq(1,20)) ex.asr <- asreml(y ...
1
vote
1answer
401 views

Avoid non-breaking-space characters printing as tildes when using texi2dvi in R

I'm using the Sweave toolchain in R to generate tex files from Sweave files as part of an R package. I use the R command: $(RSCRIPT) -e "tools::texi2dvi( 'file.tex', pdf = TRUE, clean = FALSE ...
5
votes
1answer
366 views

Including path diagram in Sweave

I use the following code to do sem analysis and draw path diagram with sem R package. library(sem) R.DHP <- readMoments(diag=FALSE, names=c('ROccAsp', 'REdAsp', 'FOccAsp', ...
1
vote
1answer
342 views

Producing figures in PDF and PNG format with TikZDevice and pgfSweave in Sweave

I use the following Sweave template to get R output into LaTeX. \documentclass[a4paper]{article} \SweaveOpts{pdf=TRUE, png=FALSE, eps=FALSE, echo=FALSE, prefix=FALSE, width=6, height=6, res=300} ...
1
vote
1answer
231 views

Some Literate tool to create fast Mind maps in RSweaveLatex?

I am looking for literate tools for mind-map-generation that would work nicely with RSweaveLatex. It is possible that there is no need for tools such as Labyrithm (which is apparently broken, at least ...
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
428 views

Having trouble with pgfSweave and tikzDevice

On Ben Bolker's advice I started using pgfSweave and tikzDevice. I'm struggling with getting R graphs into LaTeX. This is my code for pgfSweave Rnw file: \documentclass{article} \usepackage{tikz} ...
5
votes
1answer
500 views

How to input \Sexpr{ as verbatim in Sweave?

Building on my question here: Include Sweave input as verbatim Is there a way to include the term \Sexpr{ in the Sweave document as verbatim. For example, to write: R code can be evaluated inline ...
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 ...
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} ...
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 ...
0
votes
1answer
192 views

xtable in pgfSweave (on lyx) : output=tex is invalid?

Many tutorials online say that to include a table in Sweave one should write something like this: <<output=tex>>= require(xtable) stuff xtable(stuff) @ That makes sense. But when I do ...
8
votes
2answers
965 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
867 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 ...