analyze_three_dots {lazy.tools}R Documentation

Analyze Three Dots and Return the Names and the Values

Description

Analyze Three Dots and Return the Names and the Values

Usage

analyze_three_dots(..., print_the_result = 0, debug_Debug = 0)

Arguments

...

The three dots to be analyzed.

print_the_result

= 1 to print the result

debug_Debug

= 1 to print intermediate info

Details

... will be analyzed and the pair of ( name, val ) and name2 will be returned.
See the first example below.

Note that, when ... is used, partial match of formal and actual arguments may cause a confusing error.
See the last example below.

Value

A list of:
name A vector consisting of the names of each of ...
val A list consisting of the values of each of ... or NULL
name2 A vector consisting of the names of those to the equal sign of each of actual argument

Examples

cc="cccc"
analyze_three_dots( a=1, b=c(2,3), cc, list(aa=1,2), diag(2) )

# a function to print all of ... with names
mprint <- function( ... ){
 atd=analyze_three_dots( ... )
 res=NULL
 for( i in 1:length(atd$name) ){
  cat(atd$name[i],"\n")
  print(atd$val[[i]])
 }
}
mprint( 1:5, b=7:11 )


# About partial match of the arguments
# "e" will be missing
test <- function( exp, ..., debug_Debug=0 ){
	res=analyze_three_dots( ..., debug_Debug=debug_Debug  )
	Print(res)
}
expr="aaa"
test( expr, a=1, b=2, c=3, d=4, e=5, f=6, g=7 )




[Package lazy.tools version 0.1.3 Index]