s-news
[Top] [All Lists]

combine duplicated rows in a big data set

To: s-news@lists.biostat.wustl.edu
Subject: combine duplicated rows in a big data set
From: haibo tang <haibotang@yahoo.com>
Date: Fri, 6 Jul 2001 19:42:13 -0700 (PDT)
Dear Splus Users,

When handling a big data set ( 200K * 26 ), I come
across this problem. The data set ( M1 )looks like
this:
> M1
  V1 V2 V3 
1  A  X  4
2  B  X  1
3  A  Y  2
4  A  X  3
5  B  Y  5
6  B  Z  6
7  C  Z  3

What I want is M2
> M2
  V1 V2 V3 
1  A  X  7
2  B  Y  6
3  A  Y  2
4  B  Z  6
5  C  Z  3

that is, I need to add up the V3's for rows with the
same V1 and V2, for example, row 1 and 4, row 2 and 5
in M1. 

Could anyone tell me how to do it efficiently?

Thank you.

Haibo  


__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/

<Prev in Thread] Current Thread [Next in Thread>