is_flag: Determine if/which vector element are options flags

Description Usage Arguments Details Value Examples

View source: R/is_flag.R

Description

Determines if an element of a vector is an option flag (as opposed to a value ) by checking against the option style

Usage

1
2
3

Arguments

x

vector of options, for example commandArgs().

Details

is_flag and which.flag are internal functions not expected to be called directly.

They are used to identify which elements of the option vector are option names (as opposed to option values). Options are identified by getOptions('optigrab')$style$flag_test. By defailt, optigrab follows GNU-style command line arguments, i.e. those beginning with "–" or "-" and are set at the time of package loading.

Value

logical. indicating which arguments are flags.

numeric

Examples

1
2
3
4
5
  optigrab:::is_flag( c( "--foo", "bar") )
  optigrab:::is_flag( c( "--foo", "bar", "-f", "-b", "text" ) )
  
  optigrab:::which.flag( c( "--foo", "bar") )
  optigrab:::which.flag( c( "--foo", "bar", "-f", "-b", "text" ))

decisionpatterns/optigrab documentation built on Jan. 8, 2019, 3:28 a.m.