inflate                 package:mefa                 R Documentation

_I_n_f_l_a_t_e_s _a _D_a_t_a _F_r_a_m_e

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

     This function inflates a data frame according to a column
     containing integers, by repeating each rows as many times as the
     integer value. This is an internal function used by the function
     'sscount'.

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

     inflate(factors, count)

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

 factors: data frame used as factors to be repeated as many times as
          the value of 'count'. Number of rows must equal length of
          'count'.

   count: a numeric (integer) vector with the same length as number of
          rows in 'factors'.

_V_a_l_u_e:

     A data frame with columns as in 'factors' argument, and rows
     according to sum of 'count'.

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

     Peter Solymos, Solymos.Peter@aotk.szie.hu, <URL:
     http://www.univet.hu/users/psolymos/personal/>

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

     'sscount'

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

     ss <- data.frame(
     cbind(
     c("sample1","sample1","sample2","sample2","sample3","sample4"),
     c("species1","species1","species1","species2","species3","zero.count"),
     c("male","female","male","female","male","male")
     ),
     c(1, 2, 10, 3, 4, 1)
     )
     colnames(ss) <- c("sample.id", "species.id", "gender", "catch")

     inflate(ss[,1:3], ss[,4])
     inflate(ss[,1:3], c(1:6))
     inflate(ss[,1:3], rep(2, 6))

