rlatexsummarytools

export dfSummary into latex


I have a dataset consist of factors and numeric and I want to export view(dfSummary(mtcars)) in my latex is it possible? many thanks in advance

library(summarytools)
data("mtcars")
view(dfSummary(mtcars))

this is not working xtable(dfSummary(mtcars))


Solution

  • In RStudio, if you create an Rmarkdown document, with pdf as output format, you can go in Output Options > Advanced > Keep tex source file used to produce PDF.

    RStudio-Markdown-Document-Options

    When using png images (with style="grid" and specified tmp.img.dir), there is an alignment issue; you need to add this to the \includegraphics commands: \includegraphics[valign=t]. You can also use something like \raisebox{0.5\height} if the image appears too low in its table cell.