notMyName
notMyName

Reputation: 838

R markdown pdf, some output won't show

So I decided to convert my html R markdown file to a pdf knitr and I noticed that half my code output won't show. I replicated a small example here:

---
title: "Test"
author: "Brandon Morgan"
date: "1/19/2021"
output: 
  pdf_document:
    df_print: paged
    fig_caption: yes
    fig_height: 6
    fig_width: 7
    highlight: tango
    toc: yes
    toc_depth: 4
html_document: 
    code_folding: hide
    csl: biomed-central.csl
    fig_caption: yes
    fig_height: 6
    number_sections: yes
    theme: sandstone
    toc: yes
    toc_float: yes
---


# TEST

## Data

```{r}
data = iris
head(data)
```

Here's my html knitr output:

enter image description here

Here's my pdf knitr output:

enter image description here

Notice how head(data) does not show for pdf output

Upvotes: 0

Views: 958

Answers (1)

randomchars42
randomchars42

Reputation: 335

quick fix: remove df_print: paged. I can't tell you why it would not produce the result you want at the moment.

---
title: "Test"
author: "Brandon Morgan"
date: "1/19/2021"
output: 
  pdf_document:
    fig_caption: yes
    fig_height: 6
    fig_width: 7
    toc: yes
    toc_depth: 4
  html_document: 
    code_folding: hide
    csl: biomed-central.csl
    fig_caption: yes
    fig_height: 6
    number_sections: yes
    theme: sandstone
    toc: yes
    toc_float: yes
---


# TEST

## Data

```{r echo=FALSE, results=TRUE}
data = iris
head(data)
```

Upvotes: 1

Related Questions