qapply                package:FLCore                R Documentation

_M_e_t_h_o_d _q_a_p_p_l_y

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

     Returns a 'list' or 'FLlst' containing values obtained by 
     applying a function to margins for each FLQuant in a composite FLR
     object.

_G_e_n_e_r_i_c _f_u_n_c_t_i_o_n:

     qapply(X,FUN)

_M_e_t_h_o_d_s:


      _s_i_g_n_a_t_u_r_e(_X=_F_L_C_o_m_p,_F_U_N=_f_u_n_c_t_i_o_n) : 'FUN' is typically a function
          name to be searched for from the environment of the call to
          'qapply'. Additional arguments to the function are specified
          after the function name.

          'qapply' enables functions to be applied easily to all
          'FLQuants' of a composite object rather than repeating the
          code for each one separately. In the example below the
          'apply' function is nested inside 'qapply' to calculate
          averages across various dimensions for each 'FLQuant' in an
          'FLStock' object.


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

     The FLR Team

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

     FLComp apply

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

     data(ple4)

     # returns a list containing the max value for each quant
     qapply(ple4, max)

     # returns a FLStock of means across all dimensions except year
     qapply(ple4, apply, 2, mean, na.rm=TRUE) 

     # returns an FLStock of max values across all dimensions except year and age
     qapply(ple4, apply, c(1,2), max)

