multiapply               package:maDB               R Documentation

_A_p_p_l_y _a _f_u_n_c_t_i_o_n _t_o _t_w_o _a_r_r_a_y_s

_D_e_s_c_r_i_p_t_i_o_n:

     'multiapply' This function allows to apply functions that need two
     input parameters row wise or column wise to two arrays.

_U_s_a_g_e:

     multiapply(a,b,MARGIN,FUN,...)

_A_r_g_u_m_e_n_t_s:

       a: An array  wich rows or columns should be submitted to the
          function.

       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.

  MARGIN: Like the MARGIN argument in the 'apply' function, 1 means
          submit the rows to the function, 2 the columns.

     FUN: The function that should be applied. Any function that needs
          two input parameters.

     ...: Additional parameters for the function FUN.

_D_e_t_a_i_l_s:

     Like the 'apply' function this function can be used to apply
     functions to the rows or columns of a matrix, without having to
     write '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.

_A_u_t_h_o_r(_s):

     Johannes Rainer

_R_e_f_e_r_e_n_c_e_s:

_S_e_e _A_l_s_o:

     'apply'

_E_x_a_m_p_l_e_s:

     ## 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)

