Learn R Programming

optigrab (version 0.9.2.1)

opt_assign: Parse options and assign values

Description

Combines opt_get and assign for convenience.

Usage

opt_assign(x, pos = 1, inherits = FALSE, name = x, ...,
  assign.na = FALSE)

opt_assign_all(x, ..., assign.na = FALSE)

Arguments

x

character or list; variable names or alias. If no coercion is done, and the first element of a character vector of length greater than one will be used, with a warning.

pos

where to do the assignment. By default, assigns into the current environment. See 'Details' for other possibilities.

inherits

logical; should the enclosing frames of the environment be inspected? This is argument is supplied to base::assign().

name

character; name(s) of option as passed to opt_get. (Default: `x``)

...

arguments passed to opt_get

assign.na

logical; whether NA can be assigned. (Default: FALSE)

opt_assign combines opt_get and assign in one call. The name argument is passed as opt_get(name=...); it defaults to x so it is generally not needed.

opt_assign_all does multiple assignments but does not allow for a names arguments. Values are names by x.

See Also

Examples

Run this code
# NOT RUN {
  opt_assign( "foo", opts=c("--foo","bar") )
  opt_assign( c("foo","f"), opts=c("--foo","baz") )
 
# }

Run the code above in your browser using DataLab