opt | R Documentation |
This function specifies an option that is accepted by an argument parser.
The results of one or more calls to this function are typically passed to
arrg()
.
opt(label, description, arg = FALSE, default = NA_character_)
label |
A short-form (single character) and/or long-form label for the option, specified comma-separated in a single string. At most one of each form must be given. Leading hyphens are optional. |
description |
A textual description of the option, for use in the usage summary. |
arg |
The name of the option's argument, if it takes one. Otherwise
|
default |
A default value for the argument, if one is accepted. This
does not have to be a string, and arguments will be coerced to match the
mode of the default when parsed. If the option takes no argument the
default value will be |
A data frame giving details of the option. This will not usually be
used directly, but passed to arrg()
.
Jon Clayden
arrg()
# A simple flag-style option with no argument
opt("h,help", "Display this usage information and exit")
# An option that takes an integer argument called "count"
opt("n,times", "Run this many times", arg="count", default=1L)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.