condGrob | R Documentation |
Creates and returns a grid object using the function given by 'grobFun' when 'test' is 'TRUE' Otherwise a simple 'grob()' is produced with the same parameters. All grob parameters are given in '...'.
condGrob(test = TRUE, grobFun = grid::grob, name = "grob name", ...)
test |
Either 'TRUE' or 'FALSE' to indicate whether 'grobFun' is to be used (default 'TRUE') or not. |
grobFun |
The function to be used to create the grob when 'test = TRUE' (e.g. 'textGrob', 'polygonGrob', etc.). |
name |
The name to be used for the returned grob. |
... |
The arguments to be given to the 'grobFun' (or to 'grob()' when 'test = FALSE'). |
A grob as produced by either the 'grobFun' given or by 'grob()' using the remaining arguments. If 'test = FALSE' then the name is suffixed by ": 'grobFun name' arguments".
myGrob <- condGrob(test = (runif(1) > 0.5),
grobFun = textGrob,
name = "my label",
label = "Some random text")
myGrob
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.