You can ensure the name gets set appropriately like this:

> aggregate(list(Contract=df$Contract), list(ID=df$ID), max)
  ID Contract
1 01        1
2 02        3
3 03        2


---
Date:   Wed, 03 Mar 2004 21:46:27 -0600 
From:   Marc Schwartz <[EMAIL PROTECTED]>
To:   Greg Blevins <[EMAIL PROTECTED]> 
Cc:   R-Help <[EMAIL PROTECTED]> 
Subject:   Re: [R] A file manipulation question 

[...]

> aggregate(df$Contract, list(ID = df$ID), max)
ID x
1 01 1
2 02 3
3 03 2


See ?aggregate for more information. By default, aggregate() names the
function derived column as 'x'. You can of course rename it as you need.

HTH,

Marc Schwartz

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to