concat               package:gregmisc               R Documentation

_C_o_m_b_i_n_e _R _O_b_j_e_c_t_s _W_i_t_h _a _C_o_l_u_m_n _L_a_b_e_l_i_n_g _t_h_e _S_o_u_r_c_e

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

     Take a sequence of vector, matrix or data frames and combine into
     rows of a common data frame with an additional column `source'
     indicating the source object.

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

     concat(..., names=NULL)

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

     ...: vectors or matrices to combine.

   names: character vector of names to use when creating source column.

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

     If there are several matrix arguments, they must all have the same
     number of columns.  The number of columns in the result will be
     one larger than the number of columns in the component matrixes.
     If all of the arguments are vectors, these are treated as single
     column matrixes.  In this case, the column containing the
     concatinated vector data is labeled `data'.

     When the arguments consist of a mix of matrices and vectors the
     number of columns of the result is determined by the number of
     columns of the matrix arguments.  Vectors are considered row
     vectors and have their values recycled or subsetted (if necessary)
     to achieve this length.

     The `source' column is created as a factor with levels
     corresponding to the name of the object from which the each row
     was obtained.  When the `names' argument is ommitted, the name of
     each object is obtained from the specified argument name in the
     call (if present) or from the name of the object.  See below for
     examples.

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

     Gregory R. Warnes Gregory_R_Warnes@groton.pfizer.com

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

     `rbind', `merge'

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

     a  <-  matrix(rnorm(12),ncol=4,nrow=3)
     b  <-  1:4
     concat(a,b)

     concat(x=a,b)
     concat(x=a,y=b)
     concat(a,b,names=c("one","two"))

     c <- 1:6
     concat(b,c)

