Open wshropshire opened 5 years ago
Hi, sorry about the late response, I've been away on vacation. I'll be taking a closer look at this soon!
(in the meantime, a workaround is to use style = "multiline", which should fix the alignment issue while not giving ideal results in terms of graphs)
Still haven't found a solution... Seems like a limitation in Pandoc, will keep an eye open for upcoming changes.
No worries! The html output works well and I’m using summary tools as an initial snapshot of my data so no urgent need. Thanks though!
William C. Shropshire, MPH PhD student, Epidemiology
Research Graduate Assistant UTHealth Graduate School of Public Health | Department of Epidemiology, Human Genetics and Environmental Sciences (DEHGES) Center for Antimicrobial Resistance and Microbial Genomics (CARMiG) at McGovern Medical School 6431 Fannin St. Houston, TX 77030 | MSE R.234 | (830)-708-2542
From: Dominic Comtois notifications@github.com Sent: Wednesday, August 14, 2019 9:02:24 PM To: dcomtois/summarytools Cc: Shropshire, William C; Mention Subject: Re: [dcomtois/summarytools] Format error when rendering dfSummary graphs in RMarkdown PDF Output (#72)
EXTERNAL EMAIL
Still haven't found a solution... Seems like a limitation in Pandoc, will keep an eye open for upcoming changes.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_dcomtois_summarytools_issues_72-3Femail-5Fsource-3Dnotifications-26email-5Ftoken-3DAII6DHVUJI6JFBMSVHAYMODQES2LBA5CNFSM4HPQUIPKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4KT6ZQ-23issuecomment-2D521486182&d=DwMCaQ&c=bKRySV-ouEg_AT-w2QWsTdd9X__KYh9Eq2fdmQDVZgw&r=aSYF7h3Tvg41I17vOHD9ioHcqKyPaNmGralq-mVquHM&m=CBpyTmshsGfXoHmFFASvSa4pHkxA0vtM4ceup_WE7OM&s=8D3GrKMKYgM75OC6LowpO9FpOUBgqWfV3yAfs2v8N2M&e=, or mute the threadhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_AII6DHWW4PNENHK2JETCAPLQES2LBANCNFSM4HPQUIPA&d=DwMCaQ&c=bKRySV-ouEg_AT-w2QWsTdd9X__KYh9Eq2fdmQDVZgw&r=aSYF7h3Tvg41I17vOHD9ioHcqKyPaNmGralq-mVquHM&m=CBpyTmshsGfXoHmFFASvSa4pHkxA0vtM4ceup_WE7OM&s=0GWjFV0CDwybQ4gU09njfTKKY0xnSwhu1_bDfFLi9BY&e=.
Probably not the right place to ask that, but how did you manage to get the style of that table @wshropshire?
Thanks a lot.
Finally got it to work, it's not perfect since we redefine the \includegraphics
command -- so it could affect negatively other images in the document -- but it's a start! Here it is, starting with the YAML section.
For the xelatex engine, it's not mandatory, but there are several advantages to it, so I use it systematically.
---
title: "Data Frame Summaries in PDF's"
output:
pdf_document:
latex_engine: xelatex
includes:
in_header: ./fig-valign.tex
---
This is the LaTeX code in fig-align.tex:
\usepackage{graphicx}
\usepackage[export]{adjustbox}
\usepackage{letltxmacro}
\LetLtxMacro{\OldIncludegraphics}{\includegraphics}
\renewcommand{\includegraphics}[2][]{\raisebox{0.5\height}%
{\OldIncludegraphics[valign=t,#1]{#2}}}
library(summarytools)
st_options(
plain.ascii = FALSE,
style = "rmarkdown",
dfSummary.style = "grid",
dfSummary.valid.col = FALSE,
dfSummary.graph.magnif = .52,
tmp.img.dir = "/tmp"
)
define_keywords(title.dfSummary = "Data Frame Summary in PDF Format")
dfSummary(tobacco)
As always, set the knitr chunk option results="asis"
.
Fantastic! I have a dataset that I'm going to test-run this with. Thanks for your continued maintenance of this tool!
@wshropshire You're welcome. Please let me know if all goes as expected! Thx.
Hello Dominic,
Seems like my output still has the same issues with the graphical alignment in PDF format when using summarytools v0.9.8. I'll attach the summary file here.
Best,
Will
Also just to follow-up briefly, when my output is switched to 'html' with dfSummary.graph.magnif = .78
the graphical output looks fine, so again, no worries if you have other issues on your plate. The html output works just fine :)
Can you post a reproducible example with your Rmd with yaml details & included tex pls? Also, make sure your .tex file is in the appropriate directory if using relative path.
Hello Dominic,
Love the updates with the Summarytools package, super helpful!
I'm currently having an issue when I render my dfSummary output where my graphs seem to be misaligned with the appropriate row they are supposed to reside within the grid style when using RMarkdown PDF output:
However, I don't have this issue if I change my output from pdf_document to html_document. My global settings are:
and my dfSummary command is:
I've played around with col widths as well as updated to the latest version of summarytools using devtools, but still get the same result. When using html as an output, it looks perfectly fine. Therefore not a big deal, but a lot of the people I work with freak out if it's not in a PDF format. Anyways, thanks for the help!