[R] functions of functions

Robin Hankin r.hankin at noc.soton.ac.uk
Mon May 9 08:55:08 CEST 2005


I have an application where my difficulty boils down to not
being able to define a function f() with the following properties:

f("sin",0:2,x)               #returns sin(x+0) + sin(x+1) + sin(x+2)
f(c("sin","cos"), 1:2,x)     #returns sin(x+1) + cos(x+2)
f(c("sin","cos","exp"),3,x)  #returns sin(x+3) + cos(x+3) + exp(x+3)


Robin Hankin
Uncertainty Analyst
National Oceanography Centre, Southampton
European Way, Southampton SO14 3ZH, UK
  tel  023-8059-7743

More information about the R-help mailing list