Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to adjust RMarkdown for tables outside the margins and overriden labels in graphs

I would like to fix a couple of imperfections into the .pdf doc I’m trying creating with RMarkdown

enter image description here

As you could see here I have these series of tables that go out of the margin limit of the sheet. While here

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

enter image description here

Labels onto the axis are overriden. I do not know whether it is necessary but for tables I’ve just run into RMardown doc

```{r model, echo = FALSE, results = 'asis'}

iwalk(tables_models, ~ cat(knitr::knit_print(.x)))

While graphs come from this for cycle

for (i in 5:ncol(data)) {
  p <- ggboxplot(data,
                 x = "COND", y = colnames(data[i]),
                 color = "COND", palette = "npg",
                 facet.by = "SES", short.panel.labs = FALSE    
  )
  print(
    p 
    + stat_compare_means(comparisons = my_comparisons, method = 't.test', 
                         label = "p.signif", ref.group = 'NEG-CTR'))
}

Does anyone know how to fix these problems?

>Solution :

What you can do is put your R chunk inside and html tag with decreased font size.

<span style='font-size: 0.8em'>
```{r model, echo = FALSE, results = 'asis'}
iwalk(tables_models, ~ cat(knitr::knit_print(.x)))
```
</span>

Another thing I do when I need it, is to scale page size (%) in the print preview dialog box of the web browser in order to fit it. (eg, 70%).

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading