Re: [R] Aggregate by First case

2008-05-30 Thread Karl Ove Hufthammer
Dimitris Rizopoulos: > dat[!duplicated(dat$Id), ] Very elegant. I didn't know about 'duplicated()' before now. Seems like a very useful function. -- Karl Ove Hufthammer __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help

Re: [R] Aggregate by First case

2008-05-30 Thread Karl Ove Hufthammer
Jojje Andersson: > I have a dataframe with in one column an id-variable and in another a > year-variable. One id-number can occur several years. I have sorted the > dataframe on id then on year so the same id-number is sorted by year with > the first occurens at top. > > Now I want to make a subs

Re: [R] Aggregate by First case

2008-05-30 Thread Moshe Olshansky
If df is your dataframe, try aggregate(df$Year,list(df$Id),min) --- On Fri, 30/5/08, Jojje Andersson <[EMAIL PROTECTED]> wrote: > From: Jojje Andersson <[EMAIL PROTECTED]> > Subject: [R] Aggregate by First case > To: "r-help@r-project.org" > Received: Fri

Re: [R] Aggregate by First case

2008-05-30 Thread Dimitris Rizopoulos
Original Message - From: "Jojje Andersson" <[EMAIL PROTECTED]> To: Sent: Friday, May 30, 2008 9:13 AM Subject: [R] Aggregate by First case Hello! I have an maybe a to a simple question but I cant get it right. I have a dataframe with in one column an id-variable and in ano

[R] Aggregate by First case

2008-05-30 Thread Jojje Andersson
Hello! I have an maybe a to a simple question but I cant get it right. I have a dataframe with in one column an id-variable and in another a year-variable. One id-number can occur several years. I have sorted the dataframe on id then on year so the same id-number is sorted by year with the fi