简体   繁体   English

无法抑制blogdown / knitr中的消息

[英]Can't suppress messages in blogdown/knitr

Here is a blog post created with blogdown 这是一篇用blogdown创建的博客文章

The R chunk of code begins with R代码块以。开头

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

However, three messages appear each time I read a shapefile using sf::st_read 但是,每次使用sf::st_read读取shapefile时都会出现三条消息

How do I prevent these messages from appearing in the post? 如何防止这些消息出现在帖子中?

Does the answer lie in this page about knitr options? 关于knitr选项的答案在于这个答案吗?

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 . 我认为st_read只是正常打印输出,这不会受到message = FALSEwarning = 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) 如果您不需要块中的任何输出,您可以在块选项中执行results = 'hide' ,否则我认为您可以使用st_read(..., quiet = TRUE)停止打印

Originally posted by Marius in the comments 最初由Marius评论中发布

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM