Sweave is a function in the statistical programming language R that enables integration of R code into LaTeX or LyX documents.
1
vote
1answer
782 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
110 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
205 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.
0
votes
1answer
244 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
599 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
253 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
257 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
188 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
970 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
346 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
268 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 ...
8
votes
3answers
659 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
918 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
0answers
229 views
LyX & Sweave cannot generate tons of plots at once [closed]
This is less of a question than a warning. In LyX 2.1.0 with pgfSweave under Ubuntu 10.04 I've been trying to generate a number of plots with a for loop. For example
<<fig=TRUE>>=
for ...
0
votes
1answer
578 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
142 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
314 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 ...
7
votes
1answer
540 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 ...
10
votes
2answers
2k 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 ...
3
votes
4answers
445 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
487 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
204 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
738 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
396 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
672 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
495 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
911 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
959 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
456 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
373 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
509 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
408 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
625 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
485 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
785 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
1k 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 ...
2
votes
2answers
732 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 ...
7
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
944 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 ...
11
votes
4answers
569 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, ...
2
votes
1answer
681 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, ...

