I want to generate a table with the summary data of R with the results I got, I know there is a library called stargazer that does, but I did not find the documentation.
I want to generate a table with the summary data of R with the results I got, I know there is a library called stargazer that does, but I did not find the documentation.
> require("xtable")
Carregando pacotes exigidos: xtable
> data("iris")
> xtable(summary(iris))
% latex table generated in R 3.4.1 by xtable 1.8-2 package
% Wed Sep 20 15:24:36 2017
\begin{table}[ht]
\centering
\begin{tabular}{rlllll}
\hline
& Sepal.Length & Sepal.Width & Petal.Length & Petal.Width & Species \
\hline
1 & Min. :4.300 & Min. :2.000 & Min. :1.000 & Min. :0.100 & setosa :50 \
2 & 1st Qu.:5.100 & 1st Qu.:2.800 & 1st Qu.:1.600 & 1st Qu.:0.300 & versicolor:50 \
3 & Median :5.800 & Median :3.000 & Median :4.350 & Median :1.300 & virginica :50 \
4 & Mean :5.843 & Mean :3.057 & Mean :3.758 & Mean :1.199 & \
5 & 3rd Qu.:6.400 & 3rd Qu.:3.300 & 3rd Qu.:5.100 & 3rd Qu.:1.800 & \
6 & Max. :7.900 & Max. :4.400 & Max. :6.900 & Max. :2.500 & \
\hline
\end{tabular}
\end{table}
If I understood correctly what you want, one possibility is to use the "xtable" package to return an R object in the latex table format.
A solution using the stargazer
package is:
install.packages("stargazer")
library(stargazer)
data("iris")
stargazer(do.call(cbind, lapply(iris,summary)), type = "latex")