Tagged Questions
2
votes
1answer
19 views
\Sexpr shows only one value from a vector with two elements in sweave
I can't get the two elements of the vector using:
<<>>=
z=c(1,2)
@
\Sexpr{z}
I have googled a lot but don't understand why I get just the first element.
1
vote
0answers
66 views
Doodle on top of Sweave output
It might not be possible to do this, but I was wondering if there is a way to doodle on top of the LaTeX output, or in my case on top of Sweave output.
See example underneath!!
...
0
votes
0answers
57 views
does not produce output table in pdf using Sweave and xtable
If I try to get 3 tables I only get the first two. I'm running out of ideas here:
<<test.2m,echo=false,results=tex>>=
library(xtable)
a = ...
0
votes
0answers
42 views
Blackened window instead of plot generated with Sweave [closed]
I'm trying to generate two plots side by side using Sweave and the subcaption package.
The thing is, that in the created pdf I get only blackened windows instead of plots (in the separate pdf files ...
2
votes
1answer
66 views
PDFLaTeX produces black boxes after executing Sweave
There is the following code
\documentclass[a4paper]{article}
\begin{document}
hey there
<<>>=
1+1
@
\end{document}
I saved the example.Rnw in my home directory an ...
0
votes
2answers
130 views
How to remove name while including image in LaTeX?
I am including an image in R and found the name of the image file appearing with the image:
name<-c("A.pdf","B.pdf","C.pdf","D.pdf")
<<echo=FALSE,results=tex>>=
for (i in 1:4)
...
1
vote
2answers
87 views
Sweave documents: saving output for later use
I am fairly new to the idea of sweave documents. My document is a .Rnw file containing LaTeX code and R code. Part of my R code is computationally intensive and delays the compilation of my .Rnw ...
1
vote
1answer
68 views
Sweave: How to remove horizontal space in Soutput environments?
As the following example shows, there is a horizontal space added in the Soutput environment. This leads to a non-left-aligned output (see the output of rnorm(). I found that this space already exists ...
5
votes
1answer
184 views
How to randomize content with examdesign package using Sweave
Forgive me in advance if this is a dumb question, or too specific to one package. I've been using examdesign to randomize the order of questions, but I also want to randomly generate the content. I've ...
0
votes
1answer
76 views
Question mark in knitr code getting quote marks [closed]
I'm trying to use question marks in a code block using knitr, but in the compiled pdf always puts quotes around it, so, for example
<<helpCode, eval=FALSE>>=
?rnorm
@
comes out as
...
1
vote
1answer
157 views
How to obtain Sweave(l) listings with rounded corners?
I downloaded the Sweavel.sty-File from here:
http://biostat.mc.vanderbilt.edu/wiki/pub/Main/SweaveTemplate/Sweavel.sty
Now, for a modern look, I would like to produce rounded corners in the R code ...
2
votes
0answers
91 views
Sweave Float environment over 2 pages
I have a bit of Sweave code as such:
<<label = Example1, echo= true>>=
//Bunch of R Code
@
I've tried putting it in my own float environment like so
\newfloat{rcode}{h!}{rcode}
...
4
votes
2answers
196 views
How to label a code section in Sweave
I'm new to sweave and was wondering what is the appropriate way to label a code section. For example, if I have:
<<echo= true>>=
x<-5
y<-x+5
@
How would I get it to put a either ...
1
vote
1answer
118 views
Explain Soutput Schunk -block when switched from article to scrreprt
When I zwitched from article to \documentclass[fontsize=2pt]{scrreprt}, I am getting around the xtable -things:
\begin{Schunk}
\begin{Soutput}
...
\end{Schunk}
\end{Soutput}
Trial (code here)
$ R ...
5
votes
4answers
866 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 ...
0
votes
1answer
444 views
How to disable null device while usin dev.off() in R and latex?
How to disable message null device when using R and latex.
<<echo=FALSE ,results=tex>>=
data<-read.table("test",sep="\t",header=TRUE,check.names=FALSE)
...
8
votes
3answers
2k views
LaTeX techniques and templates for writing a book
I am about to write a couple of books using LaTeX. I am fairly used to producing small LaTeX articles using Sweave and R, but I have never written a book using LaTeX and I am not conversant with the ...
1
vote
1answer
486 views
Reducing R figure sizes in lyx?
I am using LyX with the Sweave module to generate some R figures within a document. I can't seem to get the figures to be smaller, and they tend to take up half a page which is far too large.
I have ...
4
votes
2answers
1k views
R, Sweave, Hmisc: pretty-print numbers
I'm creating a LaTeX tables based on a matrix in R using the 'latex' function of the Hmisc package.
dat = matrix(c(1000, 100, 10000, 10000), 2)
latex(dat, file='')
This works (as expected) ...
4
votes
1answer
627 views
Making LaTeX documents with Hebrew? (in Sweave + RStudio)
I would like to write in Hebrew in an .Rnw file, and use it with RStudio.
Searching around, I found an example for using Hebrew in LaTeX in general:
Numbers, punctuation and parenthesis reversed in ...
2
votes
2answers
868 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}
...
2
votes
1answer
335 views
pgfSweave() results in texi2dvi error “Missing \endcsname inserted”
When running pgfSweave using a file with the following sample code:
\documentclass[letter]{article}
\begin{document}
In this example we embed parts of the examples from the
\texttt{kruskal.test} ...
3
votes
3answers
470 views
Table Limit: Sweave
I'm running into an issue. It seems that when I try to output more than 17 or 18 tables to a pdf document the remaining tables are ignored. When I split them across multiple Rnw files, there is no ...
9
votes
3answers
2k views
Using fancyhdr to create an image based header and footer
I'm trying to generate a latex report (via Sweave and R) where the header of the document is an image that covers everything (including the top/left/right page margin) and the footer covers everything ...
12
votes
1answer
3k 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
784 views
Caption for longtable in Sweave
I'm using the following code in .Rnw file to generate a longtable
<<label = tabggplot2df, echo = FALSE, results = tex >>=
print(
xtable(
x = ggplot2df
, caption = ...
0
votes
1answer
110 views
Making extra produced schunk globally invisible in Sweave
I'm using ASREML-R for data analysis. When I fit the model in ASREML-R, it produces some information regarding the model like this
dat <- data.frame(y=rnorm(20),x=seq(1,20))
ex.asr <- asreml(y ...
0
votes
1answer
246 views
Avoid non-breaking-space characters printing as tildes when using texi2dvi in R
I'm using the Sweave toolchain in R to generate tex files from Sweave files as part of an R package. I use the R command:
$(RSCRIPT) -e "tools::texi2dvi( 'file.tex', pdf = TRUE, clean = FALSE ...
5
votes
1answer
253 views
Including path diagram in Sweave
I use the following code to do sem analysis and draw path diagram with sem R package.
library(sem)
R.DHP <- readMoments(diag=FALSE, names=c('ROccAsp', 'REdAsp', 'FOccAsp',
...
1
vote
1answer
257 views
Producing figures in PDF and PNG format with TikZDevice and pgfSweave in Sweave
I use the following Sweave template to get R output into LaTeX.
\documentclass[a4paper]{article}
\SweaveOpts{pdf=TRUE, png=FALSE, eps=FALSE, echo=FALSE, prefix=FALSE, width=6, height=6, res=300}
...
1
vote
1answer
188 views
Some Literate tool to create fast Mind maps in RSweaveLatex?
I am looking for literate tools for mind-map-generation that would work nicely with RSweaveLatex. It is possible that there is no need for tools such as Labyrithm (which is apparently broken, at least ...
6
votes
1answer
976 views
side-by-side xtables in Sweave
I use xtable to manage my tables in Sweave like this
<<label=tab1, echo = FALSE, results = tex>>=
print(xtable(Table1))
@
<<label=tab2, echo = FALSE, results = tex>>=
...
8
votes
1answer
346 views
Having trouble with pgfSweave and tikzDevice
On Ben Bolker's advice I started using pgfSweave and tikzDevice. I'm struggling with getting R graphs into LaTeX.
This is my code for pgfSweave Rnw file:
\documentclass{article}
\usepackage{tikz}
...
5
votes
1answer
270 views
How to input \Sexpr{ as verbatim in Sweave?
Building on my question here:
Include Sweave input as verbatim
Is there a way to include the term \Sexpr{ in the Sweave document as verbatim. For example, to write:
R code can be evaluated inline ...
8
votes
3answers
659 views
Include Sweave input as verbatim
How do I keep Sweave from compiling things in a verbatim environment? For example:
\documentclass{article}
\begin{document}
\begin{verbatim}
<<>>=
1+1
@
\end{verbatim}
\end{document}
...
0
votes
0answers
229 views
LyX & Sweave cannot generate tons of plots at once [closed]
This is less of a question than a warning. In LyX 2.1.0 with pgfSweave under Ubuntu 10.04 I've been trying to generate a number of plots with a for loop. For example
<<fig=TRUE>>=
for ...
0
votes
1answer
142 views
xtable in pgfSweave (on lyx) : output=tex is invalid?
Many tutorials online say that to include a table in Sweave one should write something like this:
<<output=tex>>=
require(xtable)
stuff
xtable(stuff)
@
That makes sense. But when I do ...
7
votes
1answer
543 views
Sweave generating invalid LaTeX
I've encountered a problem when I'm using Sweave to convert an .Rnw file into a .tex file. Sweave is replacing three options from hyperref's \hypersetup block with the value NA.
This is the section ...
10
votes
2answers
2k views
Tables with multiple panels in LaTeX, R and Sweave
I would like to know what the accepted Sweave/R/LaTeX solution is for producing tables with "panels": multiple parts, which may or may not contain the same columns, combined into one table. The ...
2
votes
1answer
489 views
Sweave only produces NAs when using Umlauts.
I have a problem with Sweave. As soon as I use any mutated vowels/Umlauts (ü, ä, etc.) Sweave produces an NA in the document although it worked before. I don't know what to do, so any help would be ...
4
votes
1answer
746 views
Difference between \Sexpr and <<>>=
I am new to sweave and learning a lot. For the most part \Sexpr works well for simple variables and also calling R functions.
But other times it will fail, I have found that I can get around this ...
6
votes
1answer
1k views
Sweave, Beamer and ggplot2
There's literally nothing on the internet showing how these work in conjunction with one another. I would really appreciate even the simplest example of a Rnw document that you would run with Sweave() ...
0
votes
1answer
373 views
What's wrong with this Sweave Document
Every time I run the code below, it runs without error. It is only when I try to sweave the output in the last frame requested does it fail. What's more confusing to a LaTeX/Sweaving newbie like ...
1
vote
1answer
510 views
Size of Sweave Output
I am very new to LaTeX and Sweave, and I am just playing around with getting some output. That said, the "output" I am getting is very large in size (physcially on the page). For example, one output ...
4
votes
2answers
1k views
Integrate 'Sweave.sty' in the TeXLive 2010 search path (on Linux)
I'd like to add 'Sweave.sty' to my search-path, so that I don't need to copy 'Sweave.sty' to every Sweave-Document I create.
I've located 'Sweave.sty' in '/usr/share/R/share/texmf/tex/latex'. I tried ...
7
votes
5answers
1k views
How to get correct dimensions for a ggplot2 plot in beamer
I have a beamer presentation made with Sweave that I'm preparing and was wanting to place some ggplot2 graphs in but the aspect ratio does not seem to come out correct. This is what is in my Rnw ...
6
votes
4answers
2k views
Multiple Tables Sweave/Latex
I am very new to LaTeX and Sweave but am excited that it may make my life much simpler when combined with R.
What I am looking to do: Create multiple crosstabs, most likely in a loop. As a result, ...

