Skip to content
Prev 175044 / 398506 Next

programming creating different functions in a loop

Good point, Greg. So to handle i as a vector, you'd probably want something
like

f <- function(x,i)outer(x,i,"+")

-- Bert

Bert Gunter
Genentech Nonclinical Biostatistics
650-467-7374

-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
Behalf Of Greg Snow
Sent: Thursday, March 26, 2009 9:54 AM
To: Bert Gunter; 'Florin Maican'; r-help at r-project.org
Subject: Re: [R] programming creating different functions in a loop

But wrong questions requiring complicated answers are sometimes more fun
:-).

One difference though is in my last example, your function will give a
different answer for f(1:3, 1:10), but for the simpler cases, yours is
probably the better.