trim                 package:FLCore                 R Documentation

_T_r_i_m _F_L_R _o_b_j_e_c_t_s _u_s_i_n_g _n_a_m_e_d _d_i_m_e_n_s_i_o_n_s

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

     Subsetting of FLR objects can be carried out using the dimension
     names by using  'trim'. A number of dimension names and selected
     dimensions are passed to the method and those are used to subset
     the input object.

     Exceptions are made for those classes where certain slots might
     differ in one or more dimensions. If trim is applied on an FLQuant
     object of length 1 in its first dimension and with dimension name
     equal to 'all', values to trim on specified for  that dimension
     will be ignored. For example, 'FLStock' objects contain slots with
     length=1 on their first dimension. Specifying values to trim along
     over the first dimension will have no effect on those slots
     ('catch',   'landings', 'discards', and 'stock'). Calculations
     might need to be  carried out to recalculate those slots if their
     quant-structured counterparts are  modified along the first
     dimension.

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

     trim(x)

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


      _s_i_g_n_a_t_u_r_e(_x=_F_L_Q_u_a_n_t) : Trims along the specified dimensions.

      _s_i_g_n_a_t_u_r_e(_x=_F_L_C_o_m_p) : Trims along the specified dimensions.

      _s_i_g_n_a_t_u_r_e(_x=_F_L_S_t_o_c_k) : Trims along the specified dimensions, but
          ignores the _quant_ (first) dimension for those slots where
          it is always of length=1.

      _s_i_g_n_a_t_u_r_e(_x=_F_L_C_o_h_o_r_t) : Trims along the specified dimensions.

      _s_i_g_n_a_t_u_r_e(_x=_F_L_I_n_d_e_x) : Trims along the specified dimensions, but
          ignores the _quant_ (first) dimension for thoe slots where it
          is of length=1.

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

     The FLR Team

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

     FLQuant-class,  FLStock-class, FLCohort-class, FLIndex-class

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

     data(ple4)

     # This is equivalent to window(catch(ple4), start=1990, end=1995)
     trim(catch(ple4), year=1990:1995)

     trim(catch.n(ple4), year=1990:1995, age=1:2)

     # Now on an FLStock
     summary(trim(ple4), year=1990:1995)

     # If 'age' is trimmed in ple4, catch, landings and discards need to be recalculated
     shpl4 <- trim(ple4, age=1:4)
     landings(shpl4) <- computeLandings(shpl4)
     discards(shpl4) <- computeDiscards(shpl4)
     catch(shpl4) <- computeCatch(shpl4)

     summary(shpl4)

