[R] repeatedly applying function with matrix-rows as argument
Prof Brian Ripley
ripley at stats.ox.ac.uk
Mon Jun 30 14:20:50 CEST 2003
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
More information about the R-help
mailing list