R: Calling from a function with the own parameters

gsifiltercall {compositions} | R Documentation

## 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)

### 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

### 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`.

### Value

The value of a call to `fkt` with those parameters modified by `gsi.filtercall` itself

### Note

Do not use gsi.* functions directly since they are internal functions of the package. However I would like to propose a function like this to become standard technology

### Author(s)

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

### See Also

`gsi`

### Examples

    #	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)

[Package compositions version 1.40-3 Index]