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


source to share





All Articles