Skip to content
Prev 205832 / 398506 Next

Arguments of a function

You could define a list and then just access the
appropriate elements of that list:

my.f <- function(a, b)
{
   x1 = equation 1
   x2 = equation 2
   x3 = equation 3
   L <- list(x1, x2, x3)
   y <- L[[a]] + L[[b]]
}

my.f(1,2)
my.f(2,3)

  -Peter Ehlers
Lisa wrote: