[R] Data frame row manipulation

2008-05-09 Thread Chip Barnaby
Greetings, Q #1 -- How does one combine data frames by row ... no cleverness a la merge(), just add rows. For example, given A with 20 rows and B with 30 rows, I want C = combine( A, B) having 50 rows. Columns having matching names should be filled from both (all) sources with

Re: [R] Data frame row manipulation

2008-05-09 Thread Jorge Ivan Velez
Hi Chip, Try this: # For Q1 R C1 = rbind(A,B) or R C2 = do.call(rbind,list(A,B)) R all.equal(C1,C2) # TRUE # For Q2 R set.seed(123) R vx=1:10 R A = matrix(rnorm(500),ncol=10) R A2=t(sapply(A,rep,10)) R A2[vx,]- A[vx,] R A2 R dim(A2) # 500 10 R dim(A)# 50 10 HTH, Jorge On Fri,