Hi all, Currently Sweave does not format the (especially numeric) value in \Sexpr{}, and I often have to round() the numbers explicitly, otherwise I will get more than 10 digits, which is not necessary for me in most cases. Is there a way to specify the number of digits to be kept for values in \Sexpr{}? e.g. can we make \Sexpr{} respect getOption('digits')? Thanks! Regards, Yihui -- Yihui Xie <xieyihui at gmail.com> Phone: 515-294-2465 Web: http://yihui.name Department of Statistics, Iowa State University 2215 Snedecor Hall, Ames, IA
Yihui Xie-2 wrote:> > > Currently Sweave does not format the (especially numeric) value in > \Sexpr{}, and I often have to round() the numbers explicitly, > otherwise I will get more than 10 digits, which is not necessary for > me in most cases. Is there a way to specify the number of digits to be > kept for values in \Sexpr{}? e.g. can we make \Sexpr{} respect > getOption('digits')? > >Currently, Sweave does an eval on Sexpr, and that can be anything other than a number (is mostly is, though). And you cannot define a new version of Sexpr in latex, because Sexpr only looks like latex, but is processed before texing. My solution is to always do the rounding and formating in the R chunk (e.g. with latexSN of Hmisc) to unclutter the Sexpr. Dieter -- View this message in context: http://r.789695.n4.nabble.com/a-rounding-option-for-Sexpr-tp3049872p3050001.html Sent from the R help mailing list archive at Nabble.com.
Apparently Analagous Threads
- What does \Sexpr[results=rd]{} exactly mean in Rd?
- Sweave \Sexpr{} advice please
- Check for updates under Windows (Was: a reliable way to check the latest version of R on CRAN?)
- R CMD check for the R code from vignettes
- The regular expressions in compareVersion()