[R] Sweave scientific real display format (e.g. 5e-12)

Dieter Menne dieter.menne at menne-biomed.de
Fri Mar 10 11:54:30 CET 2006


BORGULYA Gábor <borgulya <at> gyer2.sote.hu> writes:

> I couldn't figure and couldn't google out how to make construct a pair of 
> \Sexpr s or a LaTeX macro that would include 
>       5\cdot 10^{-12}
> into the LaTeX output istead of
>       5e-12 .


a =1.3452e-12
asp = strsplit(sprintf("%8.3g",a),"[.e]")[[1]]
sprintf("%s\\cdot %s 10^{%s}",asp[1],asp[2],asp[3])


Not really elegant....

Dieter




More information about the R-help mailing list