Search code examples
rrstudioknitrmessageupdates

After Updating R and RStudio message() function does display in console


I recently updated R (from 4.1.1 High Sierra) and RStudio (2021.09.0 +351) to R (4.3.2 "Eye Holes") intel version and RStudio (2023.09.1 +494).

When I run the program (it is a .Rmd file) in RStudio, the output works as expected. It produces a report in Word. No problems there. However, in the process of executing the code, the console is supposed to display some diagnostic messages during the process of rendering my report using the message() function. It does not. It has disappeared for whatever reason. However, when I run just the code chunk where this issue is occurring, it displays just fine in the console and as expected. I'd like to be able to view the diagnostic messages as the report is rendering like I use to be able to do in my older versions of R and RStudio. I do not have the old computer anymore. I feel like this could be a settings issue but can't figure it out. Any help for someone that is new to this is much appreciated. Thanks.

I have included a snapshot of the settings I have next to "Knit" at the top of the screen.

enter image description here

I have also included the code in question. I've tried changing message=FALSE to TRUE, warning=TRUE, remove results='asis" just to see if that would do anything. It does not. Again, if I run just this chunk only, it works just fine by itself. I should also state, I get no errors at all when running the entire .Rmd file to produce the report. Everything seems to work but I need to see the messages() in the console as the report is being produced which I am not.

```{r get_types, results='asis', warning=FALSE, message=FALSE}
message('Hello world')
```

Solution

  • This is due to a change in knitr and evaluate about a year ago. The short answer is that you need to change the chunk option message = FALSE to NA.