Displaying 1 result from an estimated 1 matches for "latexnum".
Did you mean:
lane_num
2009 Feb 06
3
Sweave and backslashes
...uld like:
4.2\cdot 10^-{8}
Instead of:
4.2e-08
The Hmisc package has a nice function for doing this- but Hmisc has a ton of
dependencies and has proved very unportable to the various machines I work
on. So, I set out to write my own function that just uses basic R commands,
it looks like this:
latexNum <- function (x,dig=4,sci=T)
{
x <- format(x,digits=dig,scientific=sci)
x <- gsub("e\\+00","",x)
x <- gsub("e\\-0([0-9]*)","\\\\cdot 10^{-\\1}",x)
x <- gsub("e\\-([0-9]*)","\\\\cdot 10^{-\\1}",x)...