R markdown: Knitr: histogram dates are not displayed when there are document titles

I was struggling with a curious issue and would appreciate if someone can help me. I am using the latest R Studio and packages.

---
title: "XYZ"
author: "ACB"
date: "Tuesday, October 21, 2014"
output: pdf_document
---

typing `r data(mtcars)`. 

Some text

```{r}
mtcars$am <- as.factor(mtcars$am)
levels(mtcars$am) <-c("Automatic", "Manual")
```

Some text

```{r fig.align='center', fig.height=4}
hist(mtcars$mpg[mtcars$am=="Automatic"], breaks=12, main="mpg for automatic vehicles", xlab="mpg", xlim=c(10, 35))
```

      

If knit above in PDF, the histogram is not displayed; if the output matches HTML, it works.

thank

+3
r knitr r-markdown


source to share


No one has answered this question yet

Check out similar questions:

106
knitr Markdown highlighting in Emacs?
92
Programmatically creating Markdown tables in R with KnitR
48
Size and resolution of the area marked R, knitr, pandoc, beamer
41
Remove hashes in R output from R Markdown and Knitr
35
figure captions, knitr links and html markdown
23
The relationship between R Markdown, Knitr, Pandoc, and Bookdown
13
insert fragments of a markdown document inside another markdown document using knitr
4
pencil in R Markdown / knitr reports
3
Title not showing in R Markdown with knitr when rendering markdown file
0
Knitr / R Markdown Privacy



All Articles
Loading...
X
Show
Funny
Dev
Pics