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
0answers
45 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. ...
3
votes
1answer
43 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 ...
0
votes
0answers
28 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
17 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 ...
3
votes
1answer
67 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
16 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
17k 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
63 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
29 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
187 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
51 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
31 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
23 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
160 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
55 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
7k 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
759 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
36 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
39 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
45 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
161 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
389 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
80 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
159 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} ...
2
votes
1answer
58 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
41 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
87 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
116 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
100 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} ...
1
vote
0answers
250 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: ...
3
votes
1answer
169 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
101 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 ...
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
59 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 ...
4
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} ...
3
votes
1answer
1k views

pdflatex cannot find PDF

I am using Sweave (in Emacs) to generate a report. I can compile the .tex file just fine. There are images (PDFs) that I generate (I have graphicx included in my \usepackage{}; I am not dealing with ...
1
vote
1answer
140 views

Cropping an image generated in R code

I would like to crop an image that is not inserted (which has been searched a lot), but an image that is generated in R code. \documentclass{article} \setlength{\parindent}{0pt} ...
2
votes
0answers
102 views

Blog publishing / creation from Latex

I have been using Latex for a few years, and have several articles written in Latex. I want to share some of these articles on blogs, and I am very new to the blogging world. Just wondering if there ...
1
vote
0answers
101 views

Using xtable with listings package

I am the listings package as suggested by the following solution provided in this question: Getting Sweave code chunks to stay inside page margins? More specifically, I am using the following piece ...
2
votes
3answers
310 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 ...
2
votes
1answer
368 views

insert figure in sweave using knitr fig.path Version 2

I have a question similar to this post. I am trying to add a .jpg to a .Rnw file (compiling LaTex with RSweave and knitr). I've tried the following without success: ...
2
votes
1answer
225 views

How to create a newcommand with knitr?

I am using knitr and I'd like to make some new commands to combine common tasks into one, e.g. \newcommand{\numps}[1]{\numprint{\Sexpr{#1}}} so that I can do something like \numps{pi}. I can't seem to ...