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
10 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. ...
1
vote
1answer
49 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
24 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
43 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 ...
3
votes
1answer
28 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
1answer
47 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
26 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
21 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 ...
0
votes
1answer
103 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 ...
0
votes
0answers
42 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 ...
3
votes
1answer
52 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 ...
2
votes
1answer
31 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
30 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
39 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 ...
1
vote
1answer
261 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
123 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 ...
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
2answers
66 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 ...
2
votes
0answers
105 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
56 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
39 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, ...
1
vote
0answers
99 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
1answer
77 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
218 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: ...
1
vote
0answers
90 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
45 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 ...
0
votes
0answers
81 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} ...
2
votes
0answers
56 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 ...
3
votes
1answer
920 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
101 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} ...
3
votes
1answer
159 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 ...
2
votes
0answers
95 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
85 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
259 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
590 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
304 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
574 views

RStudio problem with xtable “results=tex”… “object tex not found”

I am using the 'compile pdf' button in a .Rnw file in Rstudio, including the following: <<longterm1, results=tex, echo=FALSE>>= print(xtable(longterm), include.rownames=FALSE, ...
1
vote
0answers
56 views

How to use pgfplotstabletypeset in combination with sweave

I am trying to make a table in LateX in which the background colour of my cells depend on the size of a number. I found some answers on Parametrize shading in table through TikZ but I cannot get them ...
4
votes
1answer
1k 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 ...
2
votes
1answer
304 views

row and column specifications in xtable output

Using xtable I am trying to format a table x<- 1:5 y<- 11:15 mytable <- table(x,y) print(xtable(mytable)) Which gives I want to add x and y tag also at the top of the rows and sides
0
votes
0answers
81 views

Problem with Latex and Sweave

I want to use Sweave package of R to integrate my R scripts directly in Latex documents. I'm using v3.1.1 of R, where Sweave.sty is directly integrated (in R-3.1.1/share/texmf/tex/latex). I'm using ...
2
votes
1answer
121 views

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. ...
3
votes
1answer
130 views

Probsoln & Sweave

I just started learning the probsoln package so I can create problem sets. I have a basic example that is working: \documentclass{article} \usepackage{probsoln} \showanswers \begin{document} ...
1
vote
1answer
96 views

Tabs Affecting Compilation of SWeave Code

The following SWeave code, compiled using WinEdt 8.1 with the Sweave plugin produces a nice R image: \begin{figure} <<fig=TRUE, echo=FALSE>>= set.seed(123) x <- 1:10 y <- rnorm(10) ...
1
vote
1answer
88 views

Justifying the output of toLatex function of utils R package

Using utils::toLatex(sessionInfo()) in .Rnw we can get R Session Info to put in LaTeX. I would highly appreciate if someone guide me to fully justify the output of utils::toLatex(sessionInfo()). ...
0
votes
1answer
196 views

Sweave and R 3.1.0: no pdfs generated

After upgrading R to version 3.1.0 (from some version 2.x.x), the following sweave code does not produce any pdfs for the plots anymore: \documentclass[a4paper,10pt]{article} \SweaveOpts{echo=FALSE} ...
0
votes
0answers
223 views

Convert .R into Latex

I'm really new at this and I couldn't found any realted subject. So I've created my .R file where I generate my graphs from my data: barplot(wmaefile$FC,xaxt="n",col="snow2",border="black", ...
3
votes
1answer
357 views

R Chunk Code within Enumeration Environment with knitr in LyX

I need R Chunk Code within Enumeration Environment in Rnw file. The following .Rnw document works fine. \documentclass{article} \begin{document} \begin{enumerate} \item The quick brown fox jumps ...
1
vote
0answers
386 views

Control stargazer table output in combination with mathpazo and siunitx

I like the idea to control all my numeric outputs with the smallest number possible of packages. I use mathpazo to control my fonts and siunitx to control formatting. Yet when I knit a LaTeX table ...
4
votes
1answer
315 views

Memory issue when producing dense TikZ figure (14500 points scatterplot) with knitr

I have a series of plots in my document which are correctly drawn by knitr with dev=tikz. Yet figure number 7, which is much more dense than the others in terms of data points, foo, doesn't: label: ...