Skip to content
Back to formatted view

Raw Message

Message-ID: <Pine.LNX.4.44.0306301319030.3913-100000@gannet.stats>
Date: 2003-06-30T12:20:50Z
From: Brian Ripley
Subject: repeatedly applying function with matrix-rows as argument
In-Reply-To: <21F67EF0AFCF3F449AF94D739A035035B515EF@rea05.fmg.uva.nl>

apply(mymatrix, 1, function(x) myfun(x[1], x[2], x[3]))

On Mon, 30 Jun 2003, Maarten Speekenbrink wrote:

> Suppose I have a function which takes three arguments. I would like to
> repeatedly apply the function, using a matrix N*3 in which each row
> supplies the three argements for the function. Is this possible? Thank
> you for your help in advance!
> 

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595