Re: [R] create unique ID for each group

2013-05-07 Thread arun
2.2 #5 5 0002 17   0002_2 0002    2.6 #6 6 18 NA #7 7 0003 19   0003_1 NA #8 8 20      NA #9     9 0003     21   0003_2 NA A.K. From: Ye Lin To: arun Sent: Tuesday, May 7, 2013 4:05 P

Re: [R] create unique ID for each group

2013-05-07 Thread William Dunlap
ng ID and withinIDSeq or paste them together yourself and use the result as your single 'by' column. Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf &

Re: [R] create unique ID for each group

2013-05-07 Thread arun
quot;_",use.names=FALSE) #[1] "0001_1" "0001_2" "0001_3" "0002_1" "0002_2" A.K. ________________ From: Ye Lin To: arun Cc: R help Sent: Tuesday, May 7, 2013 2:54 PM Subject: Re: [R] create unique ID for each group Thanks A

Re: [R] create unique ID for each group

2013-05-07 Thread Ye Lin
. > > > > > > - Original Message ----- > From: arun > To: Ye Lin > Cc: R help > Sent: Tuesday, May 7, 2013 2:10 PM > Subject: Re: [R] create unique ID for each group > > > > Hi, > > Try this: > dat1<- read.table(text=" > ObsNumber

Re: [R] create unique ID for each group

2013-05-07 Thread Ye Lin
In each category, the order is the same. Fro example, the first match in dat2 should return to the first record in dat2 On Tue, May 7, 2013 at 11:31 AM, Chris Stubben wrote: > Yes, I tried, but the order of the IDs in dat1 and dat2 is not exactly the >> same, I simplify the data here. So in dat

Re: [R] create unique ID for each group

2013-05-07 Thread Chris Stubben
Yes, I tried, but the order of the IDs in dat1 and dat2 is not exactly the same, I simplify the data here. So in dat2, it may have records for ID=0002 first then ID=0001, also I have more than two categories under ID col I should have looked at the question more closely, sorry. Unique ids in r

Re: [R] create unique ID for each group

2013-05-07 Thread Ye Lin
Yes, I tried, but the order of the IDs in dat1 and dat2 is not exactly the same, I simplify the data here. So in dat2, it may have records for ID=0002 first then ID=0001, also I have more than two categories under ID col. On Tue, May 7, 2013 at 10:57 AM, Chris Stubben wrote: > > I want to merge

Re: [R] create unique ID for each group

2013-05-07 Thread arun
: Ye Lin Cc: R help Sent: Tuesday, May 7, 2013 2:10 PM Subject: Re: [R] create unique ID for each group Hi, Try this: dat1<- read.table(text=" ObsNumber ID  Weight 1 0001 12 2 0001  13 3   

Re: [R] create unique ID for each group

2013-05-07 Thread arun
  0001_2 #3 0001    3.2   0001_3 #4 0002    2.2   0002_4 #5 0002    2.6   0002_5 A.K. ----- Original Message - From: Ye Lin To: R help Cc: Sent: Tuesday, May 7, 2013 1:54 PM Subject: [R] create unique ID for each group Hey All, I have a dataset(dat1) like this: ObsNumber    ID 

Re: [R] create unique ID for each group

2013-05-07 Thread Chris Stubben
> I want to merge dat1 and dat2 based on "ID" in order Have you tried merge(dat1, dat2) ? If ID is the common column (and no others), then that should be all you need to join (see ?merge). And then order if needed. Chris -- Chris Stubben Los Alamos National Lab Bioscience Division MS M8

[R] create unique ID for each group

2013-05-07 Thread Ye Lin
Hey All, I have a dataset(dat1) like this: ObsNumber ID Weight 1 0001 12 2 0001 13 3 0001 14 4 0002 16 5 0002 17 And another dataset(