Extract                package:FLCore                R Documentation

_E_x_t_r_a_c_t _o_r _R_e_p_l_a_c_e _P_a_r_t_s _o_f _a_n _F_L_R _O_b_j_e_c_t

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

     Operators acting on FLQuant, FLCohort, FLPar, FLComp, and derived
     classes to extract or replace sections of an object.

     Please note the difference between referencing sections of an
     object by position, using values of class 'numeric', or by
     dimnames, of class 'character'. See examples below.

     All classes that are derived from 'FLComp' (for example, 'FLStock'
     and  'FLBiol') can be subset along the six dimensions of their
     'FLQuant' slots.

     Classes that are derived from 'FLlst' (for example, 'FLStocks' and
      'FLBiols') can be subset in a similar way to ordinary list
     objects.

     An FLFleet object has three levels (fleet, metier and catch).  The
     '[' and  '[[' operators can be used to access the different levels
     of an 'FLFleet'    object (i.e 'FLMetier' and 'FLCatch' objects).

     Using the single '[' operator returns an object of the same type
     but with only a subset of the metier and catch objects that were
     in the original object.  For example,  using '[' on an 'FLFleet'
     object returns an 'FLFleet' object, but with  only a selected
     subset of 'FLMetier' and 'FLCatch' objects.  Using '['  on an
     'FLMetier' object returns an 'FLMetier' object, but with only a 
     selected subset of 'FLCatch' objects.

     More than one metier or catch may be specified.  However, if
     multiple catches are  specified it must be possible to extract all
     of them from the metiers that are  specified.  For example,
     fleet[1:2,1:2] will extract both the first and second  'FLCatch'
     objects from the first and second 'FLMetier' objects.  If either
     of  the two metiers has only a single catch an error will be
     returned.

     Using the double '[[' operators on an 'FLFleet' or 'FLMetier'
     object  returns an object of the next level down.  For example,
     using '[[' on an  'FLMetier' returns an 'FLCatch' object.  The
     '[[' operators can be  combined to extract a single 'FLCatch' from
     an 'FLFleet' object (see below).

     Objects of class 'FLIndex-class' might have a combination of
     'FLQuant'  of various lengths along the first dimension. When
     extracting from an 'FLIndex'  object, indices for the first
     dimension are ignored for those slots whose first  dimensions is
     of length=1.

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


      [x,i,j,drop]

      [<-(x,i,j,value)

      [[<-(x,i,j,value)

      $<-(x,name,value)

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


      _s_i_g_n_a_t_u_r_e(_x=_F_L_Q_u_a_n_t,_i=_A_N_Y,_j=_A_N_Y,_d_r_o_p=_m_i_s_s_i_n_g) : Returns an
          'FLQuant' object, subset along any of the six dimensions
          (quant, year, unit, season, area and iter).

      _s_i_g_n_a_t_u_r_e(_x=_F_L_l_s_t,_i=_A_N_Y,_j=_m_i_s_s_i_n_g,_d_r_o_p=_m_i_s_s_i_n_g) : Returns a
          subset of an 'FLlst' object as an 'FLlst' object.  This also
          applies to classes derived from 'FLlst' including 'FLStocks'
          and 'FLFleets'.  It behaves in a similar way to the list
          operator '['

      _s_i_g_n_a_t_u_r_e(_x=_F_L_P_a_r,_i=_A_N_Y,_j=_A_N_Y,_d_r_o_p=_m_i_s_s_i_n_g) : Subset an 'FLPar'
          object.

      _s_i_g_n_a_t_u_r_e(_x=_F_L_S_t_o_c_k,_i=_A_N_Y,_j=_A_N_Y,_d_r_o_p=_m_i_s_s_i_n_g) : Returns an
          'FLStock' where all the 'FLQuant' slots have been subset by
          quant, year, unit, season, area and iter.

      _s_i_g_n_a_t_u_r_e(_x=_F_L_C_a_t_c_h,_i=_A_N_Y,_j=_A_N_Y,_d_r_o_p=_m_i_s_s_i_n_g) : Returns an
          'FLCatch' where all the 'FLQuant' slots have been subset by
          quant, year, unit, season, area and iter.

      _s_i_g_n_a_t_u_r_e(_x=_F_L_B_i_o_l,_i=_A_N_Y,_j=_A_N_Y,_d_r_o_p=_m_i_s_s_i_n_g) : Returns an
          'FLBiol' where all the 'FLQuant' slots have been subset by
          quant, year, unit, season, area and iter.

      _s_i_g_n_a_t_u_r_e(_x=_F_L_C_o_h_o_r_t,_i=_A_N_Y,_j=_A_N_Y,_d_r_o_p=_m_i_s_s_i_n_g) : Describe method

      _s_i_g_n_a_t_u_r_e(_x=_F_L_F_l_e_e_t,_i=_A_N_Y,_j=_A_N_Y) : Returns an 'FLFleet' object
          that contains only the i 'FLMetier's and the j 'FLCatch'es of
          the 'FLFleet' object.  i and j are vectors (numerics or
          characters) that describe the position of the objects in the
          'FLMetiers' or 'FLCatches' lists.  This enables mutiple
          'FLMetier's and 'FLCatch'es to be extracted.

      _s_i_g_n_a_t_u_r_e(_x=_F_L_F_l_e_e_t,_i=_A_N_Y,_j=_m_i_s_s_i_n_g) : Returns an 'FLFleet'
          object that contains only the i 'FLMetier's of the 'FLFleet'
          object.  i is a vector (numeric or character) that describes
          the position of the 'FLMetier' in the 'FLMetiers' lists.

      _s_i_g_n_a_t_u_r_e(_x=_F_L_M_e_t_i_e_r,_i=_A_N_Y,_j=_m_i_s_s_i_n_g) : Returns an 'FLMetier'
          that contains the i 'FLCatch'es of the 'FLMetier'.  i is a
          vector (numeric or character) that describes the position of
          the 'FLCatch'es in the 'FLCatches' list.

      _s_i_g_n_a_t_u_r_e(_x=_F_L_l_s_t,_i=_A_N_Y,_j=_m_i_s_s_i_n_g,_v_a_l_u_e=_m_i_s_s_i_n_g) : Returns the
          specified element of the list.  For example, for an
          'FLStocks' object, stocks[[1]] will return a single
          'FLStock'.

      _s_i_g_n_a_t_u_r_e(_x=_F_L_F_l_e_e_t,_i=_A_N_Y,_j=_m_i_s_s_i_n_g) : Returns the ith 'FLMetier'
          of the 'FLFleet'.  i can be a numeric describing the position
          of the 'FLMetier' in the 'FLMetiers' list, or a character
          string of the catch names.

      _s_i_g_n_a_t_u_r_e(_x=_F_L_M_e_t_i_e_r,_i=_A_N_Y,_j=_m_i_s_s_i_n_g) : Returns the ith 'FLCatch'
          of the 'FLMetier'.  i can be a numeric describing the
          position of the 'FLCatch' in the 'FLCatches' list, or a
          character string of the catch names.  This can be used with
          the 'FLFleet' accessor above to extract a single 'FLCatch'
          from an 'FLFleet' object.

      _s_i_g_n_a_t_u_r_e(_x=_F_L_l_s_t,_n_a_m_e=_c_h_a_r_a_c_t_e_r,_v_a_l_u_e=_m_i_s_s_i_n_g) : Describe method

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

     The FLR Team

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

     Extract

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

     flq <- FLQuant(rnorm(50), dimnames=list(age=1:5, year=1990:2000, season=1:4))
     flq[1,]
     flq[,1:5]
     flq[,'1990']
     flq[1:2,,,c(1,3)]

     # load a fleet
     data(bt4)
     # extract the first metier
     met <- bt4[[1]]
     # extract the first catch of that metier
     catch <- met[[1]]
     # do it all once to get the catch
     catch <- bt4[[1]][[1]]

