r - Rotate stargazer table in knitr -
i using knitr write .rnw file , stargazer packages build tables regression outputs. part working quite rotate table 90 degrees able in latex using \usepackage{sidewaystable}
outside of .rnw
\documentclass{article} \begin{document} <<table1, echo=false, message=f, warning=f, results="asis">>= library(stargazer) lm1 <- lm(mpg ~ wt, data = mtcars) lm2 <- lm(mpg ~ hp, data = mtcars) lm3 <- lm(mpg ~ cyl, data = mtcars) lm4 <- lm(mpg ~ disp, data = mtcars) stargazer(lm1, lm2, lm3, lm4, title = "basic ols models", omit.stat = c("f", "ser")) @ \end{document}
you can option float.env = "sidewaystable"
in stargazer()
\documentclass{article} \usepackage{rotating, graphicx} \begin{document} <<table1, echo=false, message=f, warning=f, results="asis">>= library(stargazer) lm1 <- lm(mpg ~ wt, data = mtcars) lm2 <- lm(mpg ~ hp, data = mtcars) lm3 <- lm(mpg ~ cyl, data = mtcars) lm4 <- lm(mpg ~ disp, data = mtcars) stargazer(lm1, lm2, lm3, lm4, title = "basic ols models", omit.stat = c("f", "ser"), float.env = "sidewaystable") @ \end{document}
Comments
Post a Comment