Questions tagged [sweave]

Sweave is a system for combining S (or R) code with LaTeX in a single document.

Sweave is a system for combining (or ) code with in a single document. It is an implementation of Donald Knuth's concept. For new projects, consider using instead, which is faster and provides more flexibility.

The Sweave file contains normal LaTeX code with R code chunks in it using the following syntax:

<<option1=TRUE,option2=3>>=
R code here
@

Generating a pdf from a Sweave file (generally with a .Rnw extension in R) is a two stage process:

  1. Running Sweave on the Rnw file, which evaluates the code chunks and generates a tex file.
  2. Compile the resulting tex file using e.g. pdflatex.

Sweave offers easy integration of R code into any LaTeX document and makes easier.

584 questions
0
votes
1 answer

how to prevent R sweave from printing for loop function

I used echo=TRUE, results=hide But the R sweave prints out the function of the for loop as well which is more than 3 pages. How can I stop R sweave from printing the function of the for loop and only print out the for {} code?
halo09876
  • 2,725
  • 12
  • 51
  • 71
0
votes
1 answer

Automating repetitive Sweave code

In my Sweave file I will have this same block of code repeat multiple times: <>= tableInstance <- getTable(first1,second) latex(tableInstance,file =…
user2763361
  • 3,789
  • 11
  • 45
  • 81
0
votes
4 answers

How to create then include a png plot in Sweave

I have a plot with millions of datapoints, so I am looking to first make a png then include it. However, I've run into the problem of not being able to include png when I go to compile time.…
user2763361
  • 3,789
  • 11
  • 45
  • 81
0
votes
1 answer

data.frame columns as tabular row labels in R

I am trying to make a table in R/Sweave using the tabular command. I want the row labels to be the headings of my data frame consca. (Each column is a question, and each row is a student's responses to each question.) The command I am using is…
wolfste4
  • 39
  • 7
0
votes
1 answer

How to access cox.zph components

I would like to use the P value of cox.zph in a Sweave document, something like this: <>= campo = campos[1] m1=coxph(Surv(TimeVar,EventVar)~Factor) z=cox.zph(m1) …. @ If I assign to an object print(cox.zph(m1)): temp =…
user2310909
  • 116
  • 8
0
votes
1 answer

RStudio Sweave - Invalid value for encoding

So, despite my best efforts to get sweave working in RStudio, I cannot do it for the life of me. Trawling the webs, and even trying the answer to this question haven't helped. OK. I'm trying to compile chapters of my supervisors book, but every time…
Albort
  • 177
  • 1
  • 11
0
votes
1 answer

what does it mean that "cacheSweave doesn't cache side-effects"?

I'm using cachesweave, but I don't think I get how everything works. I've tried to separate the code into simulation chunks and the plotting chunks, but some of the code is very long and written before I started the sweave document, so I instead…
0
votes
2 answers

xtable for arrays

I'm trying to use xtable for 3-dimensional array. My minimal example is Test <- structure(1:8, .Dim = c(2L, 2L, 2L), .Dimnames = list(c("A1", "A2"), c("B1", "B2"), c("C1", "C2"))) library(plyr) library(xtable) a_ply(.data=Test, .margins=3,…
MYaseen208
  • 22,666
  • 37
  • 165
  • 309
-1
votes
1 answer

how to fix the position of code in Sweave?

I am using sweave to drawing plots and I want to fix the position of R code without fix the position of graphs, that's to say I would like to keep the position of code in the text but have graphs floating, what should I do? Thank you It sesms that…
ruiruiyang
  • 13
  • 4
-1
votes
1 answer

How do I write into Textwrangler with Applescript?

I would like to build a shortcut for Sweave's chunck when I am writting R code. I use Textwrangler and I am pretty sure I can do it with an Apple script but I know very few of it. The idea would be to add where my cursor is : <>= @ Does…
-1
votes
2 answers

is it possible to compile R latex via knitr in a modula way

Is there any way to compile knitr subfiles separately? What I have in mind is something like the package subfiles for latex just in combination with R/knitr/Sweave? This would be great in case one has two exercises a first exercise with heavy…
-1
votes
2 answers

Plot in Sweave PDF document is lagging my computer

I am trying to include a single, less than one-page-sized plot into a Sweave/R pdf document. This plot is based on huge amounts of data - i.e. in a small plot area there are tens of thousands of points. Whenever I include the plot normally through…
user2763361
  • 3,789
  • 11
  • 45
  • 81
-2
votes
1 answer

Attempting to Compile a PDF in RStudio with MikTeX fails to generate references, instead resulting in [? ] and no bibliography

I am using Sweave in RStudio to build a pdf with the following settings: Weave Rnw files using: knitr Typeset LaTeX into PDF using: pdfLaTeX I am also on Windows and using MiKTeX. The pdf successfully compiles each time, with the exception of the…
ZekeMarshall
  • 131
  • 5
-3
votes
1 answer

Automatically create a report based on an R script and a template with Knitr

I'm using stitch function in Knitr 0.4. It works fine and gives the R script with output in ##. I wonder how to make changes to only show the normal output with R code. I tried to make the changes in knitr-template.Rnw but it did not work for me.…
MYaseen208
  • 22,666
  • 37
  • 165
  • 309
1 2 3
38
39