- 已编辑
先听一个故事,我们经常遇到这样熟悉的味道
library(tidyverse)
── Attaching packages ─────────────────────────────────────────────────────────────────────────────────────────────────── tidyverse 1.2.1 ──
ggplot2 3.1.0 purrr 0.3.0
tibble 2.0.1 dplyr 0.7.8
tidyr 0.8.2 stringr 1.4.0
readr 1.3.1 forcats 0.4.0
── Conflicts ────────────────────────────────────────────────────────────────────────────────────────────────────── tidyverse_conflicts() ──
dplyr::filter() masks stats::filter()
dplyr::lag() masks stats::lag()
suppressPackageStartupMessages
函数可以把所有的启动消息都隐藏起来
suppressPackageStartupMessages(library(tidyverse))
但是,我想说的不是这个,最近偶然看到,在 R Markdown 内还可以这样设置来屏蔽启动消息,是不是感觉很简洁很直观
```{r, echo=TRUE,R.options=list(tidyverse.quiet = TRUE)}
library(tidyverse)
```
这其实是 tidyverse 提供的一个选项
那么,我的问题来了,比如 knitr ,rmarkdown 等等其他的 R 包,如何比较方便地找出这样的隐藏选项呢? 当然不单纯指隐藏启动消息这样的功能。
当然,我们也试过在启动了 R 包以后,这样找
names(options())
[1] "add.smooth" "askpass"
[3] "asksecret" "bitmapType"
[5] "browser" "browserNLdisabled"
[7] "buildtools.check" "buildtools.with"
[9] "CBoundsCheck" "check.bounds"
[11] "citation.bibtex.max" "connectionObserver"
[13] "continue" "contrasts"
[15] "defaultPackages" "demo.ask"
[17] "deparse.cutoff" "device"
[19] "device.ask.default" "digits"
[21] "download.file.method" "dplyr.show_progress"
[23] "dvipscmd" "echo"
[25] "editor" "encoding"
[27] "error" "example.ask"
[29] "expressions" "ggvis.renderer"
[31] "help_type" "help.search.types"
[33] "help.try.all.packages" "HTTPUserAgent"
[35] "httr_oauth_cache" "httr_oob_default"
[37] "install.packages.compile.from.source" "internet.info"
[39] "keep.source" "keep.source.pkgs"
[41] "locatorBell" "mailer"
[43] "matprod" "max.print"
[45] "menu.graphics" "na.action"
[47] "nwarnings" "OutDec"
[49] "page_viewer" "pager"
[51] "papersize" "PCRE_limit_recursion"
[53] "PCRE_study" "PCRE_use_JIT"
[55] "pdfviewer" "pkgType"
[57] "plumber.swagger.url" "printcmd"
[59] "profvis.keep_output" "profvis.print"
[61] "profvis.prof_extension" "profvis.prof_output"
[63] "prompt" "readr.show_progress"
[65] "repos" "restart"
[67] "reticulate.repl.hook" "reticulate.repl.initialize"
[69] "reticulate.repl.teardown" "rl_word_breaks"
[71] "rstudio.notebook.executing" "scipen"
[73] "shiny.launch.browser" "shinygadgets.showdialog"
[75] "show.coef.Pvalues" "show.error.messages"
[77] "show.signif.stars" "str"
[79] "str.dendrogram.last" "stringsAsFactors"
[81] "terminal.manager" "texi2dvi"
[83] "timeout" "ts.eps"
[85] "ts.S.compat" "unzip"
[87] "useFancyQuotes" "verbose"
[89] "viewer" "warn"
[91] "warning.length" "width"
这种找法应该不全,剩下就是去翻 R 包的更新历史,主页介绍,最后是源代码?不知道有没有比较好的找法,捷径什么的,翻找的顺序什么的,有时候看到这样的 https://github.com/rstudio/bookdown/blob/master/inst/examples/index.Rmd#L24-L27
一半的选项不知道在干嘛,要从哪里找帮助说明