Unexpected empty page in pdf output from R Markdwon

Hi, I am creating a pdf document from Rmarkdown. And an expected blank page is created when I set warning = FALSE.

When I set warning = TRUE, everything is ok, but the warning message remains.

flile.Rmd

    ---
    documentclass: ctexart
    geometry: margin=1in
    output:
      rticles::ctex: default
    ---
    ```{r setup, include=FALSE}
    knitr::opts_chunk$set(echo = FALSE, warning = FALSE)
    library(tidyverse)
    ```
    
    ## Header
    I need to type some foreign language, so i use ctex here. 对
    ```{r}
    df <- tibble( mth = c('201901', '201902', '201903', '201904'),
                  value = c(NA, 99, 100, 98))
    df$mth <- as.Date(paste0(as.character(df$mth), '01'), format='%Y%m%d') # convert numeric to date
    
    plot <- ggplot(df, aes(x=mth, y=value)) +
      geom_line()
    ```
    
    ## I am going to plot something now
    ```{r}
    plot
    ```
    ```{r}
    plot
    ```

Any idea to get rid of warning message while keep a good page formatting?
Thanks.

I don't think it has to do with warning FALSE or TRUE.
I believe it is just something related to floating figure in PDF file.

If you add a text between the header and the first plot, it will be correct

## I am going to plot something now

We have two plots

```{r}
plot
```
```{r}
plot
```

I am not sure how you deal with floating figure in Latex but you may found some answer on the web. I don't think there is bug on the R side here.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.