[R] A file manipulation question

Gabor Grothendieck
2004-03-04T05:12:09Z

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 <MSchwartz at medanalytics.com>
To:   Greg Blevins <gblevins at mn.rr.com>
Cc:   R-Help <r-help at stat.math.ethz.ch>
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