Questions tagged [sweave]

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

Sweave is a function in the statistical programming language that enables integration of R code into LaTeX or LyX documents. The purpose is "to create dynamic reports, which can be updated automatically if data or analysis change".¹

Because the Sweave files together with any external R files that might be sourced from them and the data files contain all the information necessary to trace back all steps of the data analyses, Sweave also has the potential to make research more transparent and reproducible to others. This enables Sweave to be a cornerstone of Reproducible Research.

¹Leisch F (2002). "Sweave, Part I: Mixing R and LaTeX: A short introduction to the Sweave file format and corresponding R functions". R News 2 (3): 28–31.

250 questions
12
votes
4 answers

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, then add it to the Sweave file. Then, I Sweave…
Charlie
  • 781
4
votes
1 answer

Sweave -- Must Always Recompile Every R Script?

I am writing a large document using a Latex, WinEdt, RStudio and Sweave. I have a large number of graphs that use SWeave code blocks (>30). Many of these blocks read in large data files from disk. Most days I work on on 2-3 blocks at a time. …
JHowIX
  • 299
2
votes
0 answers

Sweave error running pdflatex.exe (exit code 1)

I'm new to sweave, and I keep getting errors. I'm trying to run the following file: \documentclass[a4paper]{article} \begin{document} \SweaveOpts{concordance=TRUE} Hello world! \end{document} And I'm just getting the error message: Writing to…
1
vote
2 answers

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] <> varA <- 2+2 @ The answer to the problem is…
1
vote
0 answers

Sweave barplot label alignment

when I compile a horizontal barplot in sweave, I get inconsistent justification for long labels (not right justified). However, when I export the barplot with RStudio, the labels are correctly aligned. How can I get labels correctly right…
isaky
  • 51
  • 3
1
vote
1 answer

Sweave function in r fails with Error (option: results seems causing the issue)

I got the below function from Prof's website: http://diskworld.wharton.upenn.edu/~foster/teaching/471/sweave-intro.pdf The said function is meant for converting sweave (.Rnw) into PDF. But when i run it on my machine, I get this error: Error in…
0
votes
0 answers

Unhappy Sweave engine in Texshop

I am working on setting up a new M1 Silicon Monterey OS Mac and my handy-dandy Sweave engine that I like to add to Texshop does not work. I have a Sweave.engine file in my Engines folder with the following: #!/bin/bash export…
0
votes
1 answer

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…