[R] a rounding option for \Sexpr{}?

Claudia Beleites cbeleites at units.it
Fri Nov 19 19:18:36 CET 2010


Dear all,

> I don't like the current behaviour, but that change could break a lot of
> existing documents. Since you can easily wrap your Sexpr arguments in a call to
> whatever formatting function you want, why force all of those users to change
> their documents?
I'm someone who would change a whole lot of \Sexpr{}s: I could get rid of all 
those round() and format()s...

Currently almost don't use \Sexpr as I find the advantage of just having a tiny 
little R expression in the text is lost if half a line of formatting code is 
required. Particularly, as one has to be careful not to have a line break in the 
\Sexpr{} as Sweave doesn't recognize those.
At the moment, I tend to use chunks with result=latex instead – which is not the 
nicest thing to read in the source as it breaks the flow of a sentence quite 
badly. But currently, it is much faster to type for me. On the other hand, maybe 
it's just about time to write a template/snippet for \Sexpr{format (, digits = 
3)}...

An alternative of course would be introducing a new kind of those commands. If 
that's going to happen, I'd vote for something really short like the brew 
syntax. But maybe I just didn't understand the advantage of \Sexpr{} and 
\VignetteXXX{} looking like Latex commands although they aren't (particularly as 
Latex source code highlighting without taking into account Sweave syntax is 
anyways messed up by $ in the \Sexpr{}.
Also, very subjectively, I'd find a syntax with angle brackets more consistent 
as the code chunks start with angle brackets anyways.

My 2 ct,

Claudia


-- 
Claudia Beleites
Dipartimento dei Materiali e delle Risorse Naturali
Università degli Studi di Trieste
Via Alfonso Valerio 6/a
I-34127 Trieste

phone: +39 0 40 5 58-37 68
email: cbeleites at units.it



More information about the R-help mailing list