Chunk Options Not Being Used

Hi! I was wondering if I could get some help with an odd issue that I've encountered when setting up a new computer.

Usually, I like running all of my chunks in RMarkdown as opposed to knitting since my file can be quite large and I sometimes will run chunks out of order. However, one issue I've seen is that my global chunk options aren't being respected. In particular, I'm seeing messages and warnings inline even though I've explicitly set them to FALSE. Here's the example I've been playing with:

title: "test"
output: html_document

```{r setup, include=FALSE}
    echo = FALSE,
    warning = FALSE,
    message = FALSE,
    fig.width = 8,
    fig.height = 4.5

```{r, include = FALSE}

write_csv(cars, "cars.csv")

read_csv("cars.csv") %>%
    plot("speed", "dist")

Since I've explicitly set warnings and messages to FALSE, I would expect that the last chunk would return only a plot. However, since I'm using read_csv, which has a message/warning about the column types, I see the following in RStudio:

As you can see, the message shows up even though I've explicitly set it to FALSE in my global chunk settings. Even weirder, when I set the chunk options i.e.,

```{r, message = FALSE, warning = FALSE}

within the chunk for messages/warnings, I still get the same result.

However, when I knit this file, it works fine; i.e., there isn't a message that shows up in the html file, so my sense is that this issue is potentially related to RStudio's inline rendering. Please let me know if you have any suggestions—any help is greatly appreciated!

1 Like

Also facing same problem with the latest updates to R + R Studio

It can be any code, not such specific code like this.

I believe that it's a regression with RStudio. I downloaded an older version of RStudio and this behavior doesn't seem to exist.


I think this is something that RStudio IDE still needs to support (you can give some :+1: )

Current, I believe global options using knitr::opts_chunkare not used by the IDE interactive mode, they are only used during knitting.

Was it working for one of you before ? If so, do you know which version ?


Yeah, it worked for me before with versions 1.3.1093 and 1.4.1106.

Thanks, I'll try to reproduce the working behavior with those version.
If you think there is an issue with IDE you can already open an issue there. Otherwise, I'll try to test this very soon with the version number you provided. Thanks !

Keep that Github ticket alive!

I tested with 1.4.1106 and it is working as you described.

With last daily version of RStudio IDE, it is not.

I think you should open an issue in RStudio github repo about this by describing how to reproduce (using the old version).

@toidtoistic Will you do it ?

For reference, issue has been opened in the IDE repo:

1 Like

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.