search for: xrep

Displaying 2 results from an estimated 2 matches for "xrep".

Did you mean: grep
2002 Nov 01
1
Manipulating dataframe
Hi: Suppose, I have a dataframe (with N rows) containing the following variables: ID X82 X85 X88 >From this, I'd like to create a new dataframe (with 3*N rows), which will have the following variables: ID X82 X85 X88 Xrep where: each ID is duplicated 3 times; X82 equals its original value for the first row and equals NA for the other two; X85 equals its original value for the second row and equals NA for the other two; X88 equals its original value for the third row and equals NA for the other two; Xrep will eq...
2010 Feb 21
4
replicate matrix
Hi all, I have a matrix, for example [,1] [,2] [1,] 1 3 [2,] 4 6 I want to replicate the matrix twice and add an extra column at the end, which is [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 1 3 1 3 1 3 2 [2,] 4 6 4 6 4 6 5 I found 'rep' only works for vector. Does anyone know how to replicate a matrix, and append the matrix?