Sweave is a function in the statistical programming language R that enables integration of R code into LaTeX or LyX documents.

learn more… | top users | synonyms

20
votes
4answers
2k views

Dynamically count and return number of words in a section

I am writing a proposal for which it is required to give the number of words of the main section in the proposal itself. I found this answer on how I can get a word count on a LaTeX document: Is ...
2
votes
1answer
393 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
3answers
721 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
6k 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 ...
16
votes
1answer
6k 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
152 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 ...
6
votes
1answer
302 views

Best way to display percentages in Sweave?

What is the best way to display percentages in Sweave? A simple example: The number 4 is \Sexpr{4 / 7} of 7. What is the best way to get the document to display: The number 4 is 57.1% of 7.
1
vote
1answer
360 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 ...
4
votes
1answer
930 views

\SweaveInput{…} with UTF-8 encoding?

Some hack here. In ?RweaveLatex manual, I found only paragraph about encoding in UTF-8 but considering Windows users: The use of fancy quotes (see ‘sQuote’) can cause problems when setting R ...
5
votes
1answer
333 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
320 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
224 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
401 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
391 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 ...
9
votes
3answers
957 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
1answer
1k views

How to sweave Matlab or Mathematica code into LaTeX.

There is a package called pgfsweave for R. It can sweave R code into a LaTeX document. I found we can gain some advantage from this method. The report document can reproduce. The font in figure ...
0
votes
1answer
830 views

StatET & Sweave cannot compile pdf files

I am new to R, Sweave, and LaTeX. I am running StatET with Eclipse 3.7 on a Windows 7 x64 OS. StatET also includes the Sweave add-on, which I use to try and compile a PDF document. I also installed ...
0
votes
1answer
180 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 ...
1
vote
0answers
403 views

Sweave won't create PNG images [closed]

Up to this morning Sweave() was regularly creating images in png format (I used png=T as an argument). At some point Sweave would no longer create any PNG image (this is a problem for me 'cause ...
8
votes
1answer
779 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
3k 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
4answers
653 views

Auctex TOC with multifile document

I'm writing my PhD thesis with LaTeX-Sweave and I use EMACS with AucTex and ESS. I have a master file (master.tex) and some slave files and my question is about the use of the TOC in the slave files. ...
2
votes
1answer
678 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
261 views

Sweave + sciposter conflict prevents italics in title

After some fooling around, I have determined that when package Sweave is loaded, italics in the title of a sciposter document is ignored (though underline works). I don't know enough to read the ...
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 ...
2
votes
2answers
530 views

Reduce space between Sinput and Soutput

I'm using Sweave in the book document class, and I'm getting really huge spacing between Sinput and Soutput evironments. \documentclass[11pt]{book} \usepackage{Sweave} \usepackage{boxedminipage} ...
5
votes
2answers
921 views

How to prevent text generated with `Sweave` from running off the right margin?

I am using Sweave to generate output for some R analysis. Some of the code generates long lines that are run off the right margin when the .tex file is compiled. I have pasted an example Schunk ...
3
votes
2answers
785 views

How to redirect SAS output to LaTeX?

I'm wondering how can the SAS output directly be redirect to LaTeX as we can do by using Sweave with R. Thanks
6
votes
1answer
1k 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() ...
3
votes
1answer
2k views

What's the best tutorial for beamer, sweave and ggplot2 combined?

I'm looking for the best example presentation publicly available on the Internet that uses beamer, sweave and ggplot2 all at the same time. Ideally it would be the actual example .Rnw file, along with ...
1
vote
2answers
2k views

Resize Arrays and Figures in a Sweave document.

How is it possible to resize figures produced via a Sweave script? I tried scalebox and others, but I can't succeed to obtain a figure with an acceptable size in my beamer with direct Sweave output ...
4
votes
1answer
1k views

FancyVerb error for Sweave output in Beamer

I'm having trouble including Sweave output in my Beamer file. Specifically, the Soutput environment is causing problems (it runs if I comment those lines out, but, of course, the table is not ...
1
vote
1answer
542 views

Using Sweave to include lattice graphics - issues with colour

I am using Sweave and the R package nlme: when including lattice graphics, (encapsulated in the print() command), the .eps files that are generated are all in black and white. The original graphic, ...
0
votes
1answer
454 views

What's wrong with this Sweave Document

Every time I run the code below, it runs without error. It is only when I try to sweave the output in the last frame requested does it fail. What's more confusing to a LaTeX/Sweaving newbie like ...
1
vote
1answer
604 views

Size of Sweave Output

I am very new to LaTeX and Sweave, and I am just playing around with getting some output. That said, the "output" I am getting is very large in size (physcially on the page). For example, one output ...
5
votes
1answer
536 views

Remove\begin{Schunk} \begin{Sinput}

I am using Sweave to produce my tex. In addition I use lstlisting to highlight the source code as below. \begin{lstlisting}[caption={Computation $\widehat Y_4$ and its ...
3
votes
2answers
724 views

Using the “master file” with emacs and Sweave

One of the things I love about emacs is being able to specify a master file, then compile an included .tex file - I just use C-c C-b For sweave documents, I have the following layout: master.Rnw ...
2
votes
1answer
567 views

vim on Rnw (sweave) files: how to indent <<>>== properly?

When I use vim-latexsuite to indent my .Rnw files, the Sweave blocks get indented, which causes them not to work properly. What I need is a way to ensure that the vim indent scheme puts these blocks ...
2
votes
1answer
895 views

I cannot use Sweave to process a file created in TeXmaker (or Gedit) under Ubuntu 10.10

I am attempting to use Sweave with R2.11.1 and Texmaker on Ubuntu 10.10. I have done this previously on Windows XP, where one saves the tex file as .Rnw and then processes it with Sweave. I have all ...
4
votes
2answers
2k views

Integrate 'Sweave.sty' in the TeXLive 2010 search path (on Linux)

I'd like to add 'Sweave.sty' to my search-path, so that I don't need to copy 'Sweave.sty' to every Sweave-Document I create. I've located 'Sweave.sty' in '/usr/share/R/share/texmf/tex/latex'. I tried ...
3
votes
2answers
902 views

Supplying string parameters to Sweave document

This must be a simple question but I don't figure out how I can do it. I would like to produce a pdf report using Sweave. And actually, many many reports. I shortened and simplified the sweave code ...
8
votes
5answers
1k 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 ...
9
votes
1answer
1k views

how to colorize syntax using R + Sweave?

I'm writing a LaTeX document using Sweave (a Beamer presentation, really), which weaves R code and LaTeX. Is there a way to make my chunks of code and its output highlighted? I could use listings ...
12
votes
4answers
650 views

Workflow in Sweave: Handling TeX errors

I've been using LaTeX and R for a few years now, but am only now bringing them together via Sweave. As I put the document together, I run my R code in its own session to verify that it works properly, ...
3
votes
1answer
881 views

Using Sweave, how can I reliably get .PNG figures instead of .EPS or .PDF figures?

I have tried to set the options in the preamble: \SweaveOpts{keep.source=TRUE, eps=FALSE, pdf=FALSE, png=TRUE}, but this does not reliably produce only .PNG (or indeed any!) figures. I say 'reliably' ...
6
votes
4answers
2k views

Multiple Tables Sweave/Latex

I am very new to LaTeX and Sweave but am excited that it may make my life much simpler when combined with R. What I am looking to do: Create multiple crosstabs, most likely in a loop. As a result, ...