\name{multiapply} \alias{multiapply} \title{Apply a function to two arrays} \description{ \code{multiapply} allows to apply functions row wise or column wise to two arrays. } \usage{ multiapply(a,b,MARGIN,FUN,...) } \arguments{ \item{a}{An array wich rows or columns should be submitted to the function.} \item{b}{An array wich rows or columns should be submitted to the function, the argument a will be passed as first argument to the function while the argument b will be passed as the second one.} \item{MARGIN}{Like the MARGIN argument in the \code{apply} function, 1 means submit the rows to the function, 2 the columns.} \item{FUN}{The function that should be applied. Any function that needs two input parameters.} \item{...}{Additional parameters for the function FUN.} } \details{ Like the \code{apply} function this function can be used to apply functions to the rows or columns of a matrix, without having to write \code{for} loops. If the result of the function FUN is numeric or a character the function returns an array containing the results, otherwise a list with the output of the function FUN.} \references{} \author{Johannes Rainer} \seealso{ \code{\link{apply}} } \examples{ ## creating two arrays a <- matrix(ncol=3,nrow=3) a[1,] <- c(1,2,2) a[2,] <- c(3,2,3) a[3,] <- c(2,2,2) b <- matrix(ncol=5,nrow=3) b[1,] <- c(8,8,6,8,10) b[2,] <- c(2,3,3,2,3) b[3,] <- c(1,1,1,1,2) ## now we perform a wilcox unpaired test for each row. multiapply(a=a,b=b,MARGIN=1,FUN=wilcox.test,paired=FALSE) } \keyword{utilities}