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

1
vote
1answer
37 views

how to make a graphic bigger

I've made the following syntax: \begin{figure}[ht] \caption{xxx } \centering <<echo=FALSE,fig=TRUE >>= load("//d049nt01/estudios$/Indicadores de Liquidacion/Tablas de prueba/pago_agg.rda"...
1
vote
0answers
21 views

Sweave error running pdflatex.exe (exit code 1) [closed]

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} ...
2
votes
1answer
13 views

Knitr/Sweave Format Code Output w/ Leading Characters

Using knitr/sweave, I need to format the R code output that gets echoed, according to editorial journal requirements. For example, the following chunk <<example,echo=TRUE>>= library(plyr)...
3
votes
1answer
58 views

No increment of a variable in a Sweave code chunk which is wrapped by a \whiledo loop

I already searched in different forums but until now I couldn’t find a solution. So I hope that you can help me… Like mentioned in the title there is no increment of my variable x in the code chunk ...
3
votes
1answer
55 views

Conditional evaluation of Sweave chunk

I'm using some R code to import and manipulate a time series. The code takes some minutes to run and, as a result, it generates a relatively small time series. Now, to prevent typesetting to take an ...
2
votes
1answer
49 views

Tables with reference to R objects in sweave / latex

I'm using knitr/R-sweave to produce a pdf-document wit LaTeX-code. I want to make a table with some numbers produced by some R calculations in the R-code-chuck above this table. When I usually want to ...
4
votes
3answers
350 views

What's the best .Rnw editor?

I'm trying to find out what people use for editing .Rnw files. Desirable features are: Auto R code completion Auto LaTeX code completion Cross platform Automatic display of R function documentation ...
1
vote
0answers
7 views

RNW, different sections depending on the value of a variable. Possible?

I am new to RNW files, and I am not sure if the following is possible. Suppose that I have the following RNW file: \documentclass[12pt,a4paper]{article} \usepackage{Sweave} \usepackage{amsmath} ...
1
vote
0answers
56 views

general footnotes in xtable

I am using sweave to create pdf. Using xtable, I am trying to insert a general footnotes under the table (i.e: This symbol means bla bla bla). I've tried a lot of things and everything get me an error ...
0
votes
0answers
18 views

Rstudio, sweave: citation X on page Y undefined on input line Z

I was looking through the previous questions but I couldn't find someone with the same problem. Apologies if this has already been answered previously. I am using sweave in Rstudio to create a paper. ...
0
votes
0answers
61 views

How to sweave .bib file in Rstudio

I am new to using sweave (not new to r or latex). I have no idea how to get a .bib file to compile. I've tried the advice I saw on setting the TEXINPUTS, BIBINPUTS and BSTINPUTS to the path where the ...
15
votes
2answers
3k views

Building TeX file from knitr Rnw as child of larger parent TeX file to use R objects and output

Here's my general problem: I'm writing my dissertation using a LaTeX template (http://www.latextemplates.com/template/masters-doctoral-thesis). The template is a parent file with multiple chapters as ...
2
votes
1answer
20 views

Set TeXstudio for Unicode .Rnw files (Sweave)

I tried to run Sweave on a .Rnw file from TeXstudio, but the unicode characters don't show up in the .tex file when I typeset with xelatex. My user command is /usr/local/bin/Rscript -e "Sweave('%.Rnw'...
3
votes
1answer
69 views

knitr code chunks in footnotes

My issue is to include verbatim output from knitr Sweave code chunks in footnotes. The BVerbatim environment (fancyvrb) gives me the formatting that I want. (NB: one needs to put \VerbatimFootnotes ...
1
vote
0answers
19 views

Special Roman/Japanese Encoding with RStudio Sweave

Is there a way for having multiple enconding support in RStudio Sweave? I have the following citation, and using different encodings like uft8 or cjk just results in errors. Reference METI. (...
24
votes
1answer
18k 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
77 views

Including TikZ picture in Sweave gets me an overfull box error

I have some difficulties in R Sweave so I hope someone could help me. I want to include two TikZ pictures using minipage and figure to the R Sweave but I get an error: Overfull \hbox (2.43085pt too ...
0
votes
1answer
32 views

xtable: extend table to both columns

Using the xtable package, is it possible to give some option to xtable function to generate a tex file which will contain following: ``` \begin{table*} ... \end{table*} ```
1
vote
1answer
244 views

Sweave R code chunk default colors in vignette

Typically, if I create a .Rnw file and add R code chunks to it, and then convert it to .pdf file, the R code text will have default color and font than the rest of the document text. An example ...
0
votes
1answer
58 views

Do not use TAB (clear tab) at every new line -> flush both

Code .... \makeatletter \def\flushboth{% \let\\\@normalcr \@rightskip\z@skip \rightskip\@rightskip \leftskip\z@skip \parindent 1.5em\relax} \makeatother .... \...
2
votes
0answers
33 views

Formatting text the same way knitr formats code, but outside of chunks

Back when I was using sweave, I could make my inline code look like R code by using \texttt{whatever} or \verb@whatever@. I am trying out knitr, and the format of the code chunks sure is pretty. But ...
2
votes
0answers
25 views

Graphics prepared with Sweave and text disorder

I am preparing a report using Sweave, it is really beautiful, but the first introductory words of my pdf-file appear after the first R-plot! How to fix it? I would like to add that I've already tried ...
1
vote
1answer
189 views

Table width 100% and changing font size

I want to size table to 100% but it has to be able to change the font size. [Purpose BEGINS here: achieve 100% width of table] print(xT, size="\\small", ...) [Purpose ENDs here]; xT is a ...
4
votes
1answer
2k views

Sweave and Knitr Figure Size

I recently made the switch from using Sweave to Knitr in order to gain Knitr's ability to cache R code chunks. So far its been fairly straightforward except for one thing. I cannot seem to find an ...
0
votes
0answers
66 views

Sweave figures - position tables between text

I am trying to insert a figure between text in my reproducible report. I tried using !h, but while this worked well for the tables, for the figures it doesn't work. I also tried using H but it is ...
5
votes
1answer
8k views

Latex Error: 'Sweave.sty' not found?

I downloaded the most recent version of Miktex Basic Installer (2.9.5105). After following the Miktex's instructions, I began working through Nicola Satori's Sweave Tutorial. The R portion of ...
3
votes
1answer
854 views

knitr: LaTex Longtable spanning several pages with word continued at bottom and caption appears only once in list of tables

I want to have longtable spanning several pages with word continued at right bottom of the table and its caption appearing only one in the list of tables using knitr. Below is my MWE in .Rnw format. ...
2
votes
1answer
42 views

Setting up winefish to compile sweave

The winefish latex editor has a "texbox" field in the preferences window, which tells it how to do various things, like PDFlatex for example. There is something about regular expressions, a command ...
0
votes
1answer
42 views

Sweave Print Codes without Considering the Width of Paper

I changed my paper size to A3 in order to make certain code chunk displayed without disruption. However, it seems that Sweave is not smart enough to detect the change of paper size and still break ...
0
votes
0answers
46 views

xtable: trim horizontal lines in table so there is no indentation

I can make a table using xtable: \documentclass[12pt,a4paper]{extarticle} \usepackage[margin=15mm]{geometry} \begin{document} <<xtable,echo=FALSE, results=tex>>= library(xtable) df <-...
2
votes
2answers
181 views

Add header and footer to each page from a pdf template

I have a document and I would like to include a header and footer to each page. The header and footer are at the top and bottom of an otherwise blank pdf file which is to be used as a template. Is ...
1
vote
1answer
443 views

Sweave-generated pdf-figure has two pages instead of one, with the first being empty

Using Sweave() in R I am trying to include a ggplot2-graphic generated by marrangeGrob() from the R package gridExtra into a pdf document. The problem occuring is that the pdf containing the figure ...
2
votes
2answers
83 views

Sweave: Floating Text and four tables anchored at bottom of the first page

I am trying to create a document that contains floating text that can extend over more than one page in length together with four tables that are anchored at the bottom of the first page (top left ...
0
votes
0answers
12 views

Sweave: Importing formatted text in a .docx file [duplicate]

I can create a Sweave .Rnw file to create a pdf document (below). But how can I import formatted text from a .docx file into the .Rnw file with the formatting preserved (eg bold, italics, paragraphs ...
2
votes
0answers
192 views

Iterating through a character/string array in LaTeX

I have an array of strings, and am trying to output each element into LaTeX. I am able to achieve that using the following code: \documentclass[12pt,english,nohyper]{tufte-handout} \usepackage[T1]{...
2
votes
1answer
63 views

Iterate latex/kintr code

I am new to knitr/Sweave. I need to prepare different versions of an exam with randomly generated questions. One version per student, each with the student's name on it. Below is a simple example with ...
1
vote
0answers
46 views

suppress debug in console

I am writing my thesis in latex and I am having trouble with the console output. Everything compiles properly, but I have pages and pages of debug messages in the console. Although not a huge issue, ...
2
votes
1answer
89 views

knitr render html code

How to render html output to pdf in knitr? Here is my code \documentclass{article} \begin{document} <<echo=TRUE, results= 'asis'>>= library(xtable) n <- data.frame(x = 1:6, y = 15:20) ...
1
vote
0answers
121 views

Creating functions in Sweave

I have a Sweave .Rnw file in R. It does a few things across chunks: Chunk 1: Selects a random integer between 1:4 and saves as variable nPlots. Chunk 2: Writes nPlots (random integer selected ...
2
votes
2answers
1k views

How to add horizontal lines within a table created by Hmisc::latex()?

lets suppose we have a table given in R and use the function latex() from the R package Hmisc to include the table in a Sweave (or knitr) document. My question is: Is there a way to add horizontal ...
0
votes
0answers
108 views

Sweave's “fig=TRUE” cannot write file

I use Sweave to get my R data into LaTeX. While this works fine with "just data", I am not able to include plots. My .Rnw-file looks like this: \documentclass[a4paper,10pt]{article} \usepackage[utf8]...
1
vote
0answers
260 views

Compiling .Rnw file into PDF in RStudio (Error: No file or directory)

I have a .Rnw file. I usually can "Compile" it into a PDF file in RStudio. However, I recently upgraded my R Version to 3.2.0. Now, when I try to "Compile" my .Rnw file I get an error: /Library/...
3
votes
1answer
174 views

Table too large for longtable?

i have a very wide table that will not fit on a page horizontally (nrow = 127, ncol = 60). I am using longtable to handle the number of rows (breaking onto the next page when the number of rows are ...
3
votes
1answer
1k 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' ...
1
vote
0answers
102 views

Table dull when transferred from R to word [closed]

I am using latex in R (mostly copied codes) to make beautiful tables. But transferring tables with the help of snipping tool used or saved as jpg from R to word, the table looks dull and not rich ...
0
votes
0answers
48 views

Latex in R getting error after putting code

I am getting this error in R ...after putting code for latex document Undefined control sequence Overfull\hbox(7.71355pt too wide) in paragraph at lines 16--16 Code is below \documentclass{article}...
9
votes
3answers
1k views

What do Sweave/knitr offer that make doesn't?

I use LaTeX to write papers and R for data analysis and visualization, so I've been looking into Sweave and knitr. The Sweave website says: The purpose is to create dynamic reports, which can be ...
2
votes
0answers
60 views

After updating to LyX 2.13: getting this message Sweave Noweb syntax? [closed]

After updating to LyX 2.1.3, I'm getting this message Sweave Noweb syntax?. I wonder what message mean and why I'm getting it? After clicking on ok, it works but I'm looking to not show this ...
2
votes
2answers
2k views

KILE Sweave Error - “Cannot open log file; did you run LaTeX?”

I am using Sweave to generate a pdf from a .Rnw file. I added a new build configuration in Kile using Kile's build-configuration settings. Settings > Tools > Build OS is Windows 7. How do I ...
5
votes
2answers
2k views

how do you put caption on figures in sweave

I have this sweave code. I need to add caption to the figures. I am doing this but it looks like I see the figure before the section{Data ANALYSIS}: \documentclass[letter,12pt]{article} \...