Hello!

Does apply() not work with customized functions?  Here is a simple example:

     AddSeven<-function(n){n+7}
     AddSeven(3)
       [1] 10
     M<-matrix(nrow=2,ncol=2,data=c(1,2,3,4),byrow=TRUE)
     M
            [,1] [,2]
       [1,]    1    2
       [2,]    3    4
     apply(x=M,margin=c(1,2),fun=AddSeven)
       Error in match.fun(FUN) : argument "FUN" is missing, with no default

Thanks for your help!
-Steve Pfeiffer

        [[alternative HTML version deleted]]

______________________________________________
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.

Reply via email to