Return value of YAML directive "draft:"

is_draft()

Value

Logical value: TRUE or FALSE.

Details

For use in Rmarkdown documents. Return value of YAML directive "draft:", either true or false.

Will return FALSE if "draft:" directive does not exist in rmarkdown file.

Will return FALSE if value of "draft:" directive is not a logical value (true or false).

See also

Author

Dave Braze davebraze@gmail.com

Examples


## May be used to conditionally watermark ggplots
library(ggplot2)
data(iris)
tmp <- ggplot(iris, aes(x=Sepal.Length, y=Sepal.Width, color=Species)) +
  geom_point()

if (is_draft()) {watermark(tmp)} else {tmp}


## If called from within YAML block use FDBpub::is_draft().
FDBpub::is_draft()
#> [1] FALSE