check_partial_match {lazy.tools}R Documentation

Check if the Partial Match is correct.

Description

Check if the Partial Match is correct.

Usage

check_partial_match(fargs1, fargs2, print = 0)

Arguments

fargs1

as sys.call() formal arguments

fargs2

as match.call() result of the matching

print

= 1 or 2 to print the details.

Details

This function checks if the arguments listed in ... are correctly matched to the formal arguments of teh called function.
The error may occur when ... contains single-lettered arguments.
This function should be called at the beginning of any function which has ... as its formal argument.

Examples

test1 <- function( alpha=0, beta=0, gamma=0, ... ){
 #
 cat("\nTop of test1\n")

 check_partial_match( sys.call(), match.call() )

 cat("\n Back to test1\n")
 Print(alpha,beta,gamma)
 val=list(...)
 cat("\n ... contains below:\n")
 print(val)
 cat("\nBottom of test1\n")

} # end of test1


test2 <- function(a){
  res=test1( alpha=1, b=rep(9,3), d=2,xx=4, g=8, print=1 )
} # end of test2


test3 <- function(a){
  res=test1( alpha=1, beta=2, gamma=3, b=rep(9,3), d=2,xx=4, g=8, print=1 )
} # end of test2


test3()

# If run, below caues error.
# test2()


[Package lazy.tools version 0.1.4 ]