[R] Interweaving of two datasets

Rui Barradas ruipbarradas at sapo.pt
Thu May 10 16:15:03 CEST 2012


Hello,

What doesn't work, exactly?
I can only see two things:

1. The order of the columns is different, first data.frame in merge
instruction comes first.
    Solution: reverse the order of data.frames in merge.
2. The order of the rows is different, the merge function orders it's output
by the common col(s).
    Solutions: leave as is or use 'order'.

# first is the first sheet in attached .xls file, second is the second and
result is the third.
# 1.
res2 <- merge(second, first)

# 2.
result[order(result$name, result$request), ]
res2[order(res2$name, res2$request), ]

If this isn't it, please state what the problem is,  "doesn't work" is a bit
vague.

Hope this helps,

Rui Barradas



lunarossa wrote
> 
> it doesn't work.
> Find attached what I need explained in xls.
> Thank you very very much!
> 
> http://r.789695.n4.nabble.com/file/n4622912/interweaving_of_2_datasets.xls
> interweaving_of_2_datasets.xls 
> 


--
View this message in context: http://r.789695.n4.nabble.com/Interweaving-of-two-datasets-tp4608505p4623624.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list