Displaying 20 results from an estimated 30000 matches similar to: "Mixing LaTeX and R Code in Loops and Functions in Sweave"
2008 Jun 13
4
Sweave: looping over mixed R/LaTeX code
Dear guRus,
I would like to loop over a medium amount of Sweave code, including both R and LaTeX chunks. Is there any way to do so? As an illustration, can I create a .tex file like this using a loop within a .Rnw file, where the "1,2,3" comes from some iteration variable in R?
################################################
\documentclass{article}
\usepackage{Sweave}
\begin{document}
2011 Sep 30
2
Understanding the workflow between sweave, R and Latex
Let's say I have written the following tiny .Rnw file:
_________________________________________
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{Sweave}
\usepackage{tikz}
\usepackage{pgf}
\begin{document}
<<>>=
sessionInfo()
@
\end{document}
_________________________________________
I then can go to R and use sweave to translate the .Rnw file into a .tex
2007 Jun 21
2
Need Help: User Defined R Functions in Sweave/Latex
Dear all,
I want to start my post by expressing my sincere gratitude for all the
help this group has given me in Sweave/Latex/R. The tools are
excellent and so is the community!
On to the question.
My Sweave code is intended to make lots of plots and create a *.pdf
document. Sweave is perfect for this. The only problem is that I find
myself using the same R code, within my Sweave input file
2006 Oct 14
2
Sweave, R and complex latex projects
Hello all,
I've been able to use R very successfully to run simple statistics and
generate the plots I require.
I've been evaluating Sweave, and have hit upon a small problem that I
don't seem to be able to workaround. Sweave runs very well for single
file latex documents, but I have a complex thesis made up of several
parts and chapters. These are arranged with a master latex file
2003 Jan 29
2
calling sweave function from latex
System info:
Mandrake 9.0
R Version 1.6.1
ESS 5.1.21
Emacs 21.2.1
-------------------
Colleagues
I've been calling R-code embedded in my LaTex document using Sweave, but
would like to make things more convenient. At present as I understand it
you first process the R chunks of code using the Sweave function
called from within R to process a "precursor file" e.g. foo.sw to get a
2003 Jan 29
2
calling sweave function from latex
System info:
Mandrake 9.0
R Version 1.6.1
ESS 5.1.21
Emacs 21.2.1
-------------------
Colleagues
I've been calling R-code embedded in my LaTex document using Sweave, but
would like to make things more convenient. At present as I understand it
you first process the R chunks of code using the Sweave function
called from within R to process a "precursor file" e.g. foo.sw to get a
2008 Nov 22
1
declaring constants in an Sweave / LaTeX document
List,
I would like to set a variable to hold, say, the size of my plots in a
Sweave document. i.e. something like the following in my '.Rnw' file:
==============================================================================
smallPlotSize = 4
<<fig1, echo=false, results=hide, height=smallPlotSize, width=smallPlotSize,
fig=true>>=
dat <- read.table("
2009 Jan 31
1
Question on Sweave-Latex and examples in the Sweave Manual
Hi List,
I have a problem with using Latex and Sweave for creating a document.
So I downloaded the Sweave manual from
http://www.statistik.lmu.de/~leisch/Sweave/Sweave-manual.pdf
and i have tried to replicate the example on pages 4-5, but i encounter the following problem: IT DOES NOT WORK. I can run Sweave, create the .tex file and then when building the .tex file in TeXnikCenter i get all
2006 Aug 04
2
Sweave special token \\ from R to latex
Dear helpeRs,
I would like to specify a newline command in R and pass it to latex
via Sweave such that it corresponds to latex' \\ command. But that
doesn't seem to be possible. If I Sweave the \n character, it just
makes a new line in latex but not the \\ command.
Is there a way such that the following code would result in latex in
blablabla \\ blablabla on different line
2008 Dec 21
2
Combining Sweave and LaTeX-packages?
Hello,
a while ago I asked for collaboration support
R <-> LaTeX.
I got some answers, and Sweave was one, to use
the Hmisc package another one.
Both have their advantages and drawbacks.
At the moment I would absolutely prefer Sweave,
because the inclusion is done automatically, and I do not
have to \include{myRTeXFile} by myself.
One (THE) drawback is, that the results of commands
2006 Sep 20
2
Sweave processes \Sexpr in commented LaTeX source (2.3.1patched and 2.4.0)
Hi all,
On FC5, using:
Version 2.3.1 Patched (2006-08-06 r38829)
and today's
R version 2.4.0 alpha (2006-09-19 r39397)
with the following .Rnw file:
\documentclass[10pt]{article}
\begin{document}
This line should print '2': \Sexpr{1 + 1}
%% This line should NOT print '2': \Sexpr{1 + 1}
\end{document}
The \Sexpr in the second line is processed even though the
2006 Sep 20
2
Sweave processes \Sexpr in commented LaTeX source (2.3.1patched and 2.4.0)
Hi all,
On FC5, using:
Version 2.3.1 Patched (2006-08-06 r38829)
and today's
R version 2.4.0 alpha (2006-09-19 r39397)
with the following .Rnw file:
\documentclass[10pt]{article}
\begin{document}
This line should print '2': \Sexpr{1 + 1}
%% This line should NOT print '2': \Sexpr{1 + 1}
\end{document}
The \Sexpr in the second line is processed even though the
2005 Aug 05
3
Latex error with Sweave example
I created a tex file following the example in the Sweave help which
produced the following files in my working directory.
Sweave-test-1-006.eps
Sweave-test-1-006.pdf
Sweave-test-1-007.eps
Sweave-test-1-007.pdf
Sweave-test-1.tex
When I run latex on this, I get a latex error, log file below. I am
running R 2.1.1 on Windows XP. I have installed "small MiKTeX" and I
have added
2011 Feb 15
2
Sweave doesn't hand on width of special characters of Computer Modern fonts to LaTeX
Hello R users,
Using R, Sweave and the cmsyase.afm font it is possible to write LaTeX
documents including R figures with text in the Computer Modern Fonts:
\documentclass{article}
\usepackage{Sweave}
\begin{document}
<<echo = false, results = hide>>=
CM <- Type1Font("CM",
c(file.path("C:/texlive/2009/texmf-dist/fonts/afm/public/cm-lgc",
2012 May 25
2
How to set symbolic link correctly so that LaTeX finds Sweave?
Hi,
I recently switched from Mac OS X (after 7 years) to Xubuntu 12.04 and I am
quite happy with it so far. I first installed R from source but I was somehow
missing certain things and I thus decided (after a new Xubuntu installation
which I had to make due to other reasons) to install R the "Ubuntu way":
,----[ R installation: ]
| 1) sudo emacs /etc/apt/sources.list
| 2) add:
| deb
2010 Aug 20
3
Has anyone used Sweave with the Beamer poster macro for Latex ?
Hello,
I'm trying to make a poster in Latex using the beamer poster macro
(http://www-i6.informatik.rwth-aachen.de/~dreuw/latexbeamerposter.php),
and use Sweave to add in R output.
This works fine for adding graphics and tables, but if I want to put
code in, the file fails to build in Latex.
My Rnw file looks like
\documentclass[final,hyperref={pdfpagelabels=false}]{beamer}
2010 Feb 20
3
LaTeX/R/Sweave Problems
Dear All:
For a few days now I have struggled with recreating a stable LaTeX/R/Sweave
environment on a new Windows XP SP3 machine. Unfortunately it seems that I
ran out of good ideas and I would like your expert opinion on how I should
approach this task and be successful. In essence, I installed (several
times) in this order the following: R2.10.1 (and then R 2.9.2), Adobe
Acrobat Reader 9
2007 Aug 31
2
Bugreport on integration of Sweave and latex beamer
I think I have isolated a problem with integration between Sweave and beamer.
Could you please see the file:
http://www.mayin.org/ajayshah/tmp/bugdemo.Rnw
Unfortunately, it uses some of my internal libraries, so you can't run
it. When I put it through Sweave, I get:
http://www.mayin.org/ajayshah/tmp/bugdemo.tex
which is, of course, a generic latex file which you can read and
2007 Oct 04
1
Sweave and LaTeX
Hi
I started using Sweave and LaTeX but have a (smaller) problem.
As I am not yet very fluent in LaTeX I do the following: I texify my snw-file to look for errors in my LaTeX and correct them.
However, if I have the following chunk, I get an error when texifying:
...
\usepackage{Sweave}
...
<<echo=F, results=tex>>=
2003 Dec 21
3
Sweave/LaTeX Problem with EPS PDF
Dear List:
I am unsure if my problem is with Sweave or LaTeX. Anyhow, I am using the MikTeX distribution and TexnicCenter.
I can easily create Sweave files and all goes well until I try to incorporate graphics. I use the same code as found in the examples found in the users manual.
In R, the graphics I want are created as Sweave is creating the .tex file. When I examine the .tex file