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

3
votes
1answer
447 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
131 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
352 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
684 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
209 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
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
944 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
820 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} ...
13
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
424 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
724 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
330 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
807 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 ...
12
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 ...
19
votes
1answer
7k 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 ...
1
vote
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
160 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
390 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
354 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
339 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
226 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
416 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
444 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
231 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
184 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
865 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
838 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 ...
12
votes
2answers
4k views

Tables with multiple panels in LaTeX, R and Sweave

I would like to know what the accepted Sweave/R/LaTeX solution is for producing tables with "panels": multiple parts, which may or may not contain the same columns, combined into one table. The ...
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} ...
5
votes
2answers
468 views

Automating LaTeX tables with specifications from R

I have some latex tables generated from R-code, the sample latex table code is below \begin{table}[ht] \begin{center} \begin{tabular}{|c|c|c|c|c|c|c|c|c|c|c|c|c} \hline & 1 & 2 & 3 & ...
3
votes
1answer
441 views

Error when using equations and mathescape in source codes using the listings package

I want to write equations within source code that i formatted with the listings package. Therefore I use mathescape=true. The strange thing is, that it only works when I change the language of my ...
19
votes
2answers
5k 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 ...
2
votes
1answer
732 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 ...
4
votes
1answer
2k views

Difference between \Sexpr and <<>>=

I am new to sweave and learning a lot. For the most part \Sexpr works well for simple variables and also calling R functions. But other times it will fail, I have found that I can get around this ...
3
votes
1answer
457 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 ...
2
votes
1answer
1k views

Wide table problem when generating PDF

I have a LaTeX wide table generated from a data frame in R using xtable, but when the PDF is created not all the data is shown, just a part of it, and the other part is hidden on the right of the PDF. ...
0
votes
2answers
2k views

generate a PDF containing R output inside latex table

I wrote a script that generates 4 variables from 2 for loops, each one of them contain a big number of data. I want to place these variables inside a data frame and then create a latex table so I can ...
6
votes
1answer
2k views

Sweave, Beamer and ggplot2

There's literally nothing on the internet showing how these work in conjunction with one another. I would really appreciate even the simplest example of a Rnw document that you would run with Sweave() ...