On 30/06/2009 12:44 PM, David Huffer wrote:
Is there any way to have Sexpr span multiple lines?

For input or output?  I.e. do you want

\Sexpr{x +
y}

or do you want the value to display on multiple lines?

I think you can't do the first. To do the second, returning a character value with an embedded newline should work. For example,

<<echo=FALSE>>=
string <- "this goes on \\\\\\\\\n two lines"
@
\Sexpr{string}

(I think you really need all those escapes to get two backslashes in the output!)

I don't know if it will happen for 2.10.x, but I would like to extend \Sexpr to be just as flexible as the <<>>= notation, by putting the Sweave options in a Latex-like option:

\Sexpr[fig=true]{ plot(rnorm(1000))}

You can do this now in R-devel in the new Sweave-like syntax in Rd files (except they don't support figs yet), but not yet in the original.

Duncan Murdoch

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to