funsample: Class for a sample of functions

Description Usage Arguments Details Value Author(s) Examples

View source: R/funsample.R

Description

An object of class funsample can be considered both as a multivariate function of one argument and as a list of univariate functions. It is generated by function funsample.

is.funsample returns TRUE if x is an object of class funsample

Usage

1
2
3
funsample(funs, ..., arglim = c(0, 1))

is.funsample(x)

Arguments

funs

a single function taking one argument, or a list of objects of class'function, that also take one argument.

...

predefined plot options, may be given as simplists.

arglim

numeric vector, an interval the functions in funlist are defined on, , defaults to c(0, 1).

x

an R object to be checked.

Details

When called with an argument x, an object of class funsample applies all functions contained in fun to x, using R-function sapply. The argument limit arglim does not matter, i.e. also values x outside the "allowed range" are processed.

The return value of a funsample is a matrix. It has colnames if the list funs was named.

Currently, only functions of one variable are allowed, i.e., for any element foo of funlist, foo(x) needs to return a numeric value as long as x is within arglim. The intervall arglim is necessary for plotting and for coercing into an fdsample object.

Predefining plot options may be particularly useful for plot annotation, such as i.e. xlab, ylab and main. They may be also given as a plutils::simplist. Options with same name are overriden from left to right, i.e., the last one given counts.

Value

funsample returns an object of class funsample, that is a function of one variable adorned with attributes

funs a list of functions
arglim numeric, allowed range of function arguments
groupsize integer, length of funs
options simplist of plot options, see {plot.funsample}

Author(s)

Ute Hahn ute@imf.au.dk

Examples

1
2
myfuns <- funsample(list(sin = sin, cos = cos), arglim = c(0, 2*pi))
myfuns(c(0, pi/4, pi/2))

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