On 12/07/2012 07:10, Dimitris.Kapetanakis wrote:
Dear all,
I created a function which it has many arguments i.e. Mu(x, Y, B, X, P)
where Mu is the function. This function works perfect but when I am trying
to use it in the apply() function in the manner apply(Matr, 1, Mu, Y=y, B=b,
X=x, P=p) it does not work and the output is: Error in match.fun(FUN) : '1'
is not a function, character or symbol
When I transform the function Mu to have less arguments like Mu(x, DATA) and
use apply by apply(Matr, 1, Mu, DATA=data) it works perfect
Does anyone knows where is my mistake?
The arguments of apply are
> args(apply)
function (X, MARGIN, FUN, ...)
so you actually called apply(X=x, MARGIN=Matr, FUN=1, Y=y, B=b, P=p)
Thanks
Dimitris
--
Brian D. Ripley, rip...@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
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.