What does “not run” mean in R help pages?

后端 未结 5 1525
抹茶落季
抹茶落季 2020-12-02 09:47

Sometimes on an R help page the phrase \"not run\" appears in comments. Check out this from the help page for \"with()\":

Examples
require(stats); require(gr         


        
5条回答
  •  盖世英雄少女心
    2020-12-02 09:55

    This adds \donttest{} and is taken (verbatim) from @hadley's R Packages.

    However for the purpose of illustration, it’s often useful to include code that causes an error. \dontrun{} allows you to include code in the example that is never used. There are two other special commands. \dontshow{} is run, but not shown in the help page: this can be useful for informal tests. \donttest{} is run in examples, but not run automatically in R CMD check. This is useful if you have examples that take a long time to run. The options are summarised below.

    Command      example    help       R CMD check
    \dontrun{}                 x
    \dontshow{}       x                          x
    \donttest{}       x        x
    

提交回复
热议问题