15

Here is a blog post created with blogdown

The R chunk of code begins with

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

However, three messages appear each time I read a shapefile using sf::st_read

How do I prevent these messages from appearing in the post?

Does the answer lie in this page about knitr options?

PKumar
  • 10,971
  • 6
  • 37
  • 52
ixodid
  • 2,180
  • 1
  • 19
  • 46
  • 8
    I think `st_read` is just printing output normally, this won't be affected by `message = FALSE` or `warning = FALSE`. If you don't need any output from the chunk you can do `results = 'hide'` in the chunk options, otherwise I think you can stop it printing using `st_read(..., quiet = TRUE)` – Marius May 23 '18 at 05:11
  • 1
    That did the trick. Thank-you. – ixodid May 23 '18 at 16:06

1 Answers1

12

Moving an apparent solution initially posted in the comments to a full answer. Reasoning outlined in this meta discussion

I think st_read is just printing output normally, this won't be affected by message = FALSE or warning = FALSE. If you don't need any output from the chunk you can do results = 'hide' in the chunk options, otherwise I think you can stop it printing using st_read(..., quiet = TRUE)

Originally posted by Marius in the comments

Zoe
  • 27,060
  • 21
  • 118
  • 148