Learn R Programming

compositions (version 2.0-8)

gsifiltercall: Calling from a function with the own parameters

Description

gsi.filtercall gives those arguments of the arguments of the calling function to called function that are made for this function. It is possible to modify the parameters on the flight.

Usage

gsi.filtercall(fkt,...,overwrite=NULL,
               transmit=character(0),default=list(...),
               prefix=if(is.character(fkt)) fkt else NULL)

Value

The value of a call to fkt with those parameters modified by

gsi.filtercall itself

Arguments

fkt

a function or a name of a function to be called

...

default arguments, which are used if not overwritten by own arguments

overwrite

a named list overwriting arguments provided in any other way

transmit

a character vector containing all named arguments that should be given to fkt, although they are not formal parameters of fkt

default

the list of default parameters to be used if not otherwise specified

prefix

the user can specify arguments for fkt explicitly by prefixing them with prefix.. Typically the prefix is the name of the function

Author

K.Gerald v.d. Boogaart http://www.stat.boogaart.de

Details

gsi.filtercall is a kind of R technology help. It allows to pass parameters in a ... fashion with less effort, more robustness and more control, since one does not need to copy all explicitly-given parameters. It simply manages the ...-parameters accepted by fkt, allowing for giving default values, or overwriting specific parameters without need to mention them in the formal arguments. This also helps to clarify the documentation of fkt.

See Also

gsi

Examples

Run this code
#	fxy <- function(x,y) x+y
#	fxz <- function(x,z) x*z
#	fxyz <- function(...) {
#	   list(gsi.filtercall("fxy"),gsi.filtercall("fxz"))
#        }	 
#	fxyz(x=1,y=2,z=7)
#	fxyz(x=1,fxz.x=2,y=10,z=55)

Run the code above in your browser using DataLab