R and LaTeX work very well together. Let me show you how to generate a LaTeX table from a R variable.
First, install the xtable
package if it’s not already.
install.packages("xtable")
Next load the package and create the tex-file with the table variable result
. For illustration purposes, I create a matrix with random values.
library(xtable) result <- replicate(6, rnorm(10)) # random matrix print(xtable(result), type="latex", file="output.tex")
Since you probably don’t need an object that holds the LaTeX code, creating and writing the code to a file is combined in one command.
Note: You can control the number of digits using:
xtable(result, digits=-3)
The minus puts numbers into scientific format.
Jose
Si la tabla que genera contiene varios decimales, con que instruccion le digo que me la genere con todos los decimales?, ya que por default solo la genera con dos decimales.
Jose
Ya estuvo…..no me habia dado cuenta