Tagged Questions

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

0
votes
1answer
906 views

Looping a code-chunk in LaTeX

I want to generate a report for three types of analysis I am performing. But each time when I perform the analysis it can happen that one or more than one type of analysis occur. I want to put ...
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
377 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
2answers
3k views

How to teach latex to find Sweave.sty? [Ubuntu 12.04; TeXLive 2011]

I work on XUbuntu 12.04 and I have installed R 2.15. Since the package manager only provides TeX Live 2009, I use the following to install TeX Live 2011 on XUbuntu: download install-tl-unx.tar.gz ...
2
votes
1answer
228 views

Rstudio output in Hebrew

(Follow-up to Making LaTeX documents with Hebrew? (in Sweave + RStudio)) Trying to reproduce the above answer, I followed these instructions without success, under Windows 7. The best result I got ...
2
votes
1answer
501 views

Sweave.sty Rd.sty on texlive 2011 (OpenSUSE 12.1)

I am trying to make Sweave.sty and Rd.sty globally available on my system. After reading related posts on StackExchange, I changed texmf.cnf, so that kpsewhich --expand-var='$TEXMF' results in ...
1
vote
1answer
227 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 ...
5
votes
3answers
585 views

Sweave Multiple Chapters

I am writing a large Sweave document that will be broken up into many chapters with the final output being a large pdf of everything and an individual pdf for each chapter (with the same page and ...
1
vote
1answer
146 views

Using toggles from etoolbox to switch Sweave Schunks of code on and off

I would like to use the toggles from etoolbox to direct Sweave to evaluate or not evaluate chunks of code. Example: \newtoggle{FirstTime} \toggletrue{FirstTime} %\togglefalse{FirstTime} ...
1
vote
2answers
291 views

LaTeX/Sweave - How to reproduce code blocks in an appendix?

I hope this is in the right place. For my statistics assignments, I do the computation inline with Sweave, like so: \begin{itemize} \item[Problem 1] <<label=block1,eval=T,echo=F>> ...
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) ...
1
vote
1answer
458 views

Adjust line numbers in error messages

Question Is there any way I can alter the line-numbers reported by TeX and friends in error messages? This is almost an identical question to Add offset to line number (in error message) when using ...
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
673 views

Yasnippet, Sweave: How to make snippets work from .Rnw files?

I use yasnippet's defined in ~/.emacs.d/plugins/yasnippet-0.6.1c/snippets/text-mode/latex-mode to insert small pieces of code when working with LaTeX. I recently started to use Sweave and therefore ...
1
vote
1answer
4k views

LaTeX Error: Illegal character in array arg using apsrtable in R

I am using sweave in R-Studio and am attempting to use the R package apsrtable. Both the model objects I am passing apsrtable are lm objects, and I get the error illegal character in array arg ...
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
879 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 ...
0
votes
1answer
725 views

LaTeX, Sweave: How to get \upshape (or \rm) in lines which display code?

How can get an upshape font (\rm) [with Sweave] in lines which display code (such as 1:300 + runif(300)) below? I tried a couple of things (I found fontshape=n online), but they did not influence the ...
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} ...
7
votes
0answers
352 views

Can I import existing .Rnw Sweave file into LyX? [closed]

I am trying to import an existing Sweave .Rnw file into LyX. I wonder whether LyX is capable of doing it? My LyX version is 2.02 and I can use its Sweave module with no problem. I find out it does ...
22
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
444 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
881 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
9k 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
165 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
349 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
411 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
1k 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
371 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
349 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
234 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
433 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
521 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
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} ...
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
1k 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
195 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
438 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
893 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
4answers
757 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
776 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
284 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 ...
5
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
2answers
616 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} ...