funsample_list_methods: List like methods for class funsample

Description Usage Arguments Details Value Author(s) Examples

Description

Subsetting, concatenation and printing of funsample. object

Usage

1
2
3
4
5
6
7
8
## S3 method for class 'funsample'
c(..., recursive = FALSE)

## S3 method for class 'funsample'
x$name

## S3 replacement method for class 'funsample'
x$name <- value

Arguments

...

for method "c":funsample objects or functions to be concatenated, otherwise further options passed to next methods

recursive

ignored, for compatibility with generic function c

x

funsample object from which a function is to be extracted or replaced

name

character string or name (possibly backtick quoted) of a function contained x.

value

replacement value, needs to be a function, or NULL.

Details

Method "c" concatenates the function lists (funsample objects) or functions contained in its arguments. The first argument is always a funsample object, otherwise this method would not have been called. Any functions contained in the further arguments are appended to the function list of the first argument. The attribute "arglim" of the result is obtained as intersection of the arglims in the arguments. If this intersection is empty, the method returns NULL and issues a warning. The options attribute which contains plot options (in particular axis labels) is coerced from the options attributes of the ... arguments. Should there be several options with the same name, priority is on the options of the first funsample in ....

If ... contains objects that are neither funsamples nor functions, an ordinary list object is returned.

Assigning NULL to a function element of in a funsample x is equivalent to removing that element from the function sample.

Value

An urfunction, or NULL.

For x$name <- value a funsample object.

Author(s)

Ute Hahn ute@imf.au.dk

Examples

1
2
3
4
5
6
7
8
9
myfuns <- funsample(list(sin = sin, cos = cos), arglim = c(0, 2*pi))
myfuns2 <- funsample(list(exp = exp, log = log), arglim = c(0, 2*pi))
myfuns <- c(myfuns, tan = tan, myfuns2, f = function(x) x^2)
myfuns(c(0, pi/4, pi/2))
myfuns$f(3)
myfuns$f <- function(x) x - 1
myfuns$g <- function(x) x^2 + 1
myfuns$log <- NULL
myfuns(c(0, pi/4, pi/2, 3))

fdnonpar documentation built on May 2, 2019, 5:54 p.m.