similar to: Sweave: \Sexpr{} inside <<>>?

Displaying 20 results from an estimated 2000 matches similar to: "Sweave: \Sexpr{} inside <<>>?"

2007 Oct 07
5
how to use \Sexpr{} with sweave
I'm trying to learn Sweave. So far things are going well with the chunks of code identified by << >>= But I'm having trouble with the in-line text use of \Sexpr. Here is a short example .Rnw file: \documentclass[12pt]{article} \usepackage[margin=1.25in]{geometry} \usepackage{graphicx} \usepackage{Sweave} \begin{document} <<test>>= pnorm(1) @ \Sexpr{2+6}
2012 Feb 23
1
Sexpr not getting expanded in Sweave
An Sweave file, 'test.Rnw': \documentclass{article} \title{Sweave minimal} \author{MK} \begin{document} \maketitle We try Sweave: <<1>>= data(airquality) summary(airquality) x <- airquality[1, 1] @ I try Sexpr: \Sexpr{x} We plot: \begin{center} <<2, fig=TRUE, echo=FALSE >>= boxplot(Ozone ~ Month, data = airquality) @ \end{center} \end{document} I check the
2012 Aug 21
2
Sweave: R chunk inside caption?
Hi Folks, I'm surprised, but I didn't find this question addressed anywhere. I'd like to generate a LaTeX caption with R code. I've tried the code below, but I get the following TeX error: ! Argument of \@caption has an extra }. <inserted text> \par l.21 } Any thoughts? Perhaps I'll have to write the "\caption{}" text with R? thanks!
2007 Aug 21
4
Formatting Sweave in R-News
Hi, I am editing a document for submission to the R-news newsletter, and in my article my Sweave code inserts a dynamically generated PDF report that my R program generates. However, when I insert the PDF using the following Sweave code: \newpage \includegraphics[scale=1.0]{\Sexpr{print(location)}} \newpage (in tex this looks like): \newpage \includegraphics[scale=1.0]{/home/arjun/sample.pdf}
2004 Jul 05
1
Apparent conflict between \Sexpr in Sweave and R2HTML
I have come across an apparent bug in the operation of Sweave. If I load the package R2HTML then execution of \Sexpr{} in an *.Rnw file no longer works. The \Sexpr{} code is simply written to the *.tex file. Below are my *.Rnw file, commands, and output. The Sweave file, Sweave-test-1_short.Rnw: % -*- mode: noweb; noweb-default-code-mode: R-mode; -*- \documentclass{article} \title{A Test
2008 Jul 27
2
Colors in Sweave
Hi list, I was using Sweave and was wondering if anyone has had any luck changing the font colors of the code chunks. For instance, in my .Rnw preample I tried including: === \usepackage[usenames]{colors} \definecolor{darkred}{rgb}{0.545,0,0} \definecolor{midnightblue}{rgb}{0.098,0.098,0.439} \DefineVerbatimEnvironment{Sinput}{Verbatim}{fontshape=sl,formatcom={\color{midnightblue}}}
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 Mar 20
2
Convert Sweave document to a function
I like Sweave, which I consider to be a great contribution. I have just written a .Rnw document that comes to about 6 pages of mixed code and mathematical explanation. Now I want to turn the R code into a function. My R code currently contains statements like N<-1000 and theta<- pi/10. In the next version of the document, I want N and theta to be parameters of a function, so that they can be
2012 Jan 19
2
Sweave question - Setting Soutput code chunks to stay inside page margins?
Hello all, 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" (in Sweave) once that happens? Here are two cases this happens in the resulting .tex file (one is a "hard" case, and the other is simpler) \begin{Schunk} \begin{Sinput} >
2009 May 09
2
Sweave \Sexpr{} advice please
Dear List, First off, my deepest gratitude to the Sweave developers: this tool has improved my quality greatly. A question in my work I use \Sexpr{} statements scalar values and the xtable package for all manner of tables. What I'd like to do is to use a vector inline, rather than a whole separate table. Something like: %%%%%%%%%%%%%%%% begin code % Latex junk % Sweave block:
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
2009 Feb 04
2
Sweave and \Sexpr{}
Hi: I am trying to create a dynamic latex table using \Sexpr{} but it's not evaluating it. I also tried the example below without Sweave and also fails. I have also copied the Sweave.sty to my working directory but nothing seems to work. Do I need to have certain package in order to run \Sexpr{}? \documentclass[a4paper]{article} \usepackage{C:/R/R-2.8.1/share/texmf/Sweave} \begin{document}
2010 Jan 30
1
Sweave - have Sexpr print 3 digits when the last is 0
Hi, I want 3 digits printed even if the last one is zero with \Sexpr{} For example: > ghg.06[12] [1] 0.2501008 I want: 0.250 What I've tried: \Sexpr{round(ghg.06[12],3)} 0.25 \Sexpr{format(ghg.06[12])} % set options(digits=3) in earlier rnw chunk 0.25 \Sexpr{round(ghg.06[12],4} %but I want 3 not 4 digits 0.2501 Thanks in advance. Elizabeth Stanny epstanny at gmail.com
2006 Sep 21
2
Sweave processes \Sexpr in commented LaTeX source
Marc, >I have a large .Rnw file and was in the process of doing some debugging. >I had set some R chunks to 'eval=false' in the process. This resulted in >some R objects not being created that were in turn used in the >subsequent \Sexpr's. I have often the same problem, I'm using a construct like : <<eval=F>>= x <- rnorm(100) @ I have
2008 Mar 19
4
Sweave does not parse \Sexpr{}
Hi, has anybody encountered and solved the following problem? I continued work now on a different computer where I have also used Sweave successfully before. I can run Sweave() and it generates a .tex file. All code chunks are processed and translated to Latex perfectly fine but somehow only the \Sexpr{} tags are not parsed. This is an example .Rnw: \documentclass{article} \usepackage{Sweave}
2003 Sep 24
1
Sweave \Sexpr() issue
Hi, I'm having a little issue with \Sexpr{bla} relating to the number of digits it is using to print its output. I understand that what \Sexpr{bla} does is parsing 'bla' inside R and then returns it coerced into a character string. The problem I'm having is that I'm losing control over the number of digits it's using to print it's output. For example, let's take:
2008 Sep 06
2
Sweave and/or beamer issue
Dear Friends, I not sure whether this is an Sweave or a beamer problem. The Rnw file: \documentclass[compress,smaller]{beamer} %\documentclass{article} %\usepackage{beamerarticle} \usepackage{Sweave} \title{Psychophysics II} \date{September 9, 2008} \begin{document} \frame{ \begin{Schunk} \begin{Sinput} > ro <- 0.2 > c <- seq(from = -3, to = 4, by = 0.1) > fn <- 1 -
2010 May 13
1
Using Sweave in hostile environments
I'm trying to put together a poster using the LaTeX a0poster package and including some things from pstricks to get gradient shading, etc. The problem is that the default environments used by Sweave don't work where I need them. A simple code chunk like <<eval=FALSE>>= x <- 1 @ buried in a minipage within a psshadowbox gives the error Runaway argument? > x <- 1
2009 Mar 17
1
Combining Sweave and fancyvrb
I find Sweave very useful and I was trying to combine it with the latex package fancyvrb. I was trying to get line numbering and labels in order to reference the lines where particular commands occur. Unfortunately, I haven't been able to figure out how to do it. Maybe somebody can help me. The following is a sample Rnw file: the first part shows what I would like to get, the second what I