Learn R Programming

vfunc (version 1.0)

vfunc-package: tools:::Rd_package_title("vfunc")

Description

If f <- function(x){x^2} and g <- function(x){x+1} it is a constant source of annoyance to me that “f+g” is not defined. Package vfunc allows you to do this.

Arguments

Author

tools:::Rd_package_author("vfunc")

Maintainer: tools:::Rd_package_maintainer("vfunc")

Documentation Index

tools:::Rd_package_indices("vfunc")

Details

The package defines a single S4 class, vf. This has a single slot, .Data, of type function which means that vf objects inherit much of the behaviour of functions, but for which new methods (such as the Arith group of S4 generics) may be defined.

Examples

Run this code
f <- as.vf(function(x){x^2})

f + Sin

as.function(f*Sin + Exp)(1:4)

Run the code above in your browser using DataLab