| getusage | R Documentation |
Generate a usage string from a getopt spec matrix.
getusage(spec, command = getfile(), usage = "Usage: %command %options")
spec |
The getopt specification, or spec of what options are considered
valid. The specification must be either a 4-5 column matrix, a 4-5 column data frame, or a
character vector coercible into a 4 column matrix using
Column 1: the long flag name. A multi-character string. Column 2: short flag alias of Column 1. A single-character string.
May be Column 3: Action of the flag. A string. Possible values:
For backwards compatibility Column 4: Data type to which the flag's argument shall be cast using
Column 5 (optional): A brief description of the purpose of the option. The terms option, flag, long flag, short flag,
and argument have very specific meanings in the context of this
document. Read the “Details” section of |
command |
The string to use in the usage message as the name of the script. See argument usage. |
usage |
A template string for the usage line. |
A character string with the usage message.
spec <- matrix(c(
'verbose', 'v', 2, "integer",
'help' , 'h', 0, "logical",
'count' , 'c', 1, "integer",
'mean' , 'm', 1, "double",
'sd' , 's', 1, "double"
), byrow = TRUE, ncol = 4)
cat(getusage(spec, command = "myscript"))
cat(getusage(spec, command = "myscript",
usage = "Usage: %command %options FILE"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.