gpt4 book ai didi

rstudio - 在 readr 和 knitr 中显示进度

转载 作者:行者123 更新时间:2023-12-05 07:35:05 25 4
gpt4 key购买 nike

我目前正在使用 .Rmd 笔记本,RStudio 版本 1.1.442。

根据 Knitr 手册和各种小插图中的不同示例,在我的笔记本中,我要求 readr(已安装版本:1.1.1)不显示进度使用隐藏代码块的栏:

```{r global_opts, echo=FALSE}
options(readr.show_progress = FALSE)
```

如果没有这个规范,文档就会随着 readr 进度条的每个百分比步骤呈现出来(如果我没记错的话,有一次,呈现过程只返回“使用列规范解析”消息)。

已经尝试过:

  • 在 chunck 选项中设置 results='hide'echo = FALSE:这些选项不符合我的需要,因为它们也抑制了列规范;

  • 设置 block 选项 warning=FALSE 不会抑制 col 规范或进度条打印;

来自 RStudio's RMarkdown website block 选项部分:

  • include = FALSE prevents code and results from appearing in the finished file. R Markdown still runs the code in the chunk, and the results can be used by other chunks.
  • echo = FALSE prevents code, but not the results from appearing in the finished file. This is a useful way to embed figures.
  • message = FALSE prevents messages that are generated by code from appearing in the finished file.
  • warning = FALSE prevents warnings that are generated by code from appearing in the finished.

我正在寻找一种方法来将进度条保留在控制台中,而无需将其呈现在最终的 HTML/PDF 呈现文档中。

谢谢。

最佳答案

您可以使用 readr 函数 show_progress。

read_delim("myFile", progress = show_progress())

这只会在控制台中运行命令时显示进度条,但不会在交互式 markdown 文档中显示。

关于rstudio - 在 readr 和 knitr 中显示进度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49750641/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com