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

0
votes
0answers
24 views

Table error: Not in outer par mode

I'm using Latex and Sweave. The example below is a MWE of my .Snw file. \usepackage[utf8]{inputenc} \usepackage[portuguese]{babel} \usepackage{amsmath} \usepackage{amssymb} \usepackage{colortbl} ...
2
votes
2answers
1k 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 ...
2
votes
1answer
22 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
123 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 ...
2
votes
1answer
42 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, ...
8
votes
3answers
496 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 ...
0
votes
0answers
39 views

Sweave in TexShop

I am trying to configure Sweave directly from Texshop, currently I am using versions 3.44 and 3.11 (Maverick build) for Textshop and R respectively. I have followed the instructions given on the ...
4
votes
1answer
413 views

Color first row in a xtable generated table

I am trying to color the FIRST row of my table. But if I add \rowcolor[gray]{0.95} to the FIRST row the colored row will be the SECOND. Indeed it is quite straight forward to modify from the second ...
1
vote
0answers
38 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 ...
1
vote
0answers
115 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 ...
6
votes
2answers
1k views

longtable misplaced noalign

Question Why am I getting multiple misplaced \noalign errors? Reproducible example \documentclass{scrartcl} \usepackage{longtable} \usepackage{booktabs} \begin{document} \section{Table test} ...
2
votes
1answer
99 views

Column Vector Sweave \Sexpr

I'm having big problems trying to compile a file using Sweave displaying a vector defined in an R chunk, as a column vector in Latex using pmatrix, I have something like this: ...
2
votes
1answer
85 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
37 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
47 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. ...
8
votes
1answer
331 views

Is it possible to get Sweave/knitr in RStudio to output the .tex file without typesetting it?

I would like to know if it is possible to tell Sweave or knitr in RStudio to create the .tex file without trying to typeset it. I want to be able to run my .Rnw file and produce a .tex file which I ...
3
votes
1answer
61 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} ...
10
votes
2answers
1k 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 ...
1
vote
1answer
51 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
41 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
2answers
728 views

Fit to landscape longtable generated with xtable and sweave

I read many TEX questions/answers on fitting a table to your page width, but cannot figure out how to do apply it in my context (using xtable/sweave). Everything that I tried (using adjustbox, tabu) ...
0
votes
1answer
254 views

Xtable and Sweave

My question is regarding xtable and sweave. I have a certain table created in RStudio and want to create a pdf file using it. I use the package Sweave and write the necessary code and I get the ...
0
votes
1answer
105 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
70 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
165 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 ...
6
votes
1answer
134 views

noalign and \include

I have reduced my code to the following lines: \documentclass[9pt,letterpaper,oneside]{amsart} \usepackage{graphicx} \usepackage[table, dvipsnames]{xcolor} \usepackage{longtable} ...
0
votes
1answer
113 views

Count the characters in a section and check against range

I want to count the number of characters within a section and then display if that value is below, in, or above the limit. I have grabbed the code from Dynamically count and return number of words in ...
1
vote
0answers
104 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 ...
3
votes
1answer
104 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: ...
0
votes
0answers
24 views

Why does \usepackage{Sweave} change table width?

Recently is has been indicated (Why could \usepackage{Sweave} be affecting my graphics scaling?) that adding \usepackage{Sweave} to your preamble might change the width of your graphics. Peter solved ...
1
vote
1answer
148 views

How to render LaTeX (math) in Sweave (R) code comments

background A asked this question on SO yesterday because it seemed to be more programming-oriented, but there weren't any responses. Perhaps someone here might have an idea? I am writing a Sweave ...
1
vote
0answers
84 views

Error R Sweave and Knitr Plugins at WinEdt 8.0?

I try a simple example document .rnw at WinEdt with R Sweave Plugin like this : \documentclass{article} \begin{document} \SweaveOpts{concordance=TRUE} \textbf{hello world} ...
1
vote
1answer
191 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} ...
21
votes
1answer
9k 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 ...
2
votes
1answer
125 views

Color the column of a latex table produced by xtable

How can I use the R xtable package to produce a table with a colored column? This post shows how to color a row, but I can't figure out how to do the same for columns.
0
votes
0answers
29 views

How to use texmaker with Sweave?

I've tried to use Sweave with texmaker but it doesn't work. I go to the menu "R Sweave", I push the button "->" and texmaker creates a wrong latex file with a lot of "NA". When I try to do pdflatex ...
3
votes
2answers
96 views

Typeset R character vectors

I have two vectors in R that I want to typeset. The first vector includes the titles and the second the body texts. Please consider the following MWE \documentclass{article} \begin{document} ...
1
vote
0answers
51 views

How to export changes from a .tex file back to the source .Rnw file

Let's say my work-flow is writing a paper with multiple R chunks as a .Rnw then compiling it into a .tex file and then typesetting it into the final document. Now, after the document has been ...
1
vote
2answers
28 views

Scan () and Sweave Help [closed]

I used x=scan() for my data set and I do not know what the proper code is to put it in my sweave file. I have tried looking on the internet for help, but I could not find anything. I did try ...
4
votes
1answer
242 views

inline knitr code that isn't a simple number

It is easy enough to do something like \Sexpr{1 + 1}. But how can I do \Sexpr{mymatrix} with mymatrix being a matrix object in R workspace? More generally, how can I print object that is more complex ...
2
votes
2answers
115 views

First row in second table created is blacked out

I am a LATEX/R/Sweave newbie and am encountering an issue while creating a report. The issue is that as shown in the figure below the first heading in the second table is blacked out. I am able to ...
1
vote
1answer
83 views

Sweave boxplots — not the required output

I want to produce a boxplot like this in R: fishdata <- read.csv("http://dl.dropbox.com/s/4w0utkqdhqribl4/fishdata.csv", header=T) attach(fishdata) boxplot(fishdata[,-1], las=3) which looks like ...
3
votes
1answer
173 views

Why could \usepackage{Sweave} be affecting my graphics scaling?

I'm using Sweave to produce a large, multi part academic thesis. I had neglected to specify \usepackage{Sweave} in my preamble, but everything was working fine until I added some verbatim output from ...
4
votes
1answer
60 views

Turning off line-wrapping in auctex for smooth transition with ess in same file

I sometimes use auctex + ess for Sweave/knitr documents. Every time I switch from auctex to ess and vice versa, there is a pause/jolt while the auctex lines re-wrap themselves. Previously, I also ...
0
votes
0answers
48 views

Sweave pdf is failing

fig=TRUE month.=season(x03) x03.lm=lm(x03~month.+time(x03)) summary(x03.lm) @ This part of my file is failing and I am not sure why. I have attached library(TSA) for the season part, but it ...
2
votes
1answer
2k views

Controlling formatting options for xtable

All, I'm a LaTex/knitr/Sweave amateur and have had trouble finding answers to what seem like they should be fairly simple questions online. I have a .Rnw script that I am currently compiling to PDF ...
0
votes
0answers
89 views

Make .Rnw child document independent from main document

This is a followed-up question to this answer. I have a variables.Rnw document in charge with the task of loading data from R datafiles and create R variables that I will then compile into a .tex ...
0
votes
0answers
52 views

Is it possible to place a chunk within a chunk?

I am asking this question because I need to loop a \section tile by a chunk and place the according result in the section using another chunk. Here is an example of one circle: The chunk for ...
2
votes
2answers
2k views

Missing character: There is no ? in font cmr12!

I'm not quite sure how to diagnose this issue. This is what I see in my log file. However, there are no "?" symbols in my work. FWIW, Here's my preamble: \documentclass[12pt]{article} ...
6
votes
6answers
2k views

How to comment in an R-chunk?

I'm quite new to both R and LaTeX, but I'm trying to work with both, using Sweave. I know you can comment in R using # and in LaTeX by using %. However, when I write a #comment in an R-chunk (between ...