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}
knitr::opts_chunk$set(
echo = FALSE,
warning = FALSE,
message = FALSE,
fig.width = 8,
fig.height = 4.5
)
```
```{r, include = FALSE}
library(tidyverse)
```
```{r}
write_csv(cars, "cars.csv")
```
```{r}
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!