1

I have a data.frame in R with three columns,

A=cbind(c(1,2),c(10^4,10^3),c(4535.45,324.252))

is there a way to generate a LaTeX table, using xtable, such that:

  • The first appears like 1 $ 2 \\
  • The second appears like $ 1 x10^4$ & $1x 10^3$ (only 1 significant figure is kept),
  • The third keeps 3 significant figures: $4.53 x 10^4$ & $3.24 x 10^3$?

1 Answer 1

1

mwe

\documentclass{article}
\usepackage{booktabs}
\begin{document}
<<results='asis',echo=F>>=
library(xtable)
A=cbind(c(1,2),c(10^4,10^3),c(4535.45,324.252))
print(xtable(A, display = c("g","g","g","g"), 
digits=c(1,1,1,-2)), math.style.exponents = T,
include.rownames=F,booktabs=T)
@
\end{document}
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .