Skip to content

Help in getting aggregated data

3 messages · Gabor Grothendieck, Deepak Manohar

#
Hi team,
   I have the data of the form:
I need the output of the form
As you can see, the Z value contains the maximum for each of the (x,y)
combinations.

I used
y
x    1  2  3  4
  1  3 NA NA NA
  2 NA  2 NA NA
  3 NA NA  5 NA
  4 NA NA NA  4

Not sure If I have any standard function to convert this to the data
frame that I need. Can you help me convert the last array into the
data frame? If there is any other way apart from using the "by"
function, please inform me regarding that as well.

-- Deepak Manohar T
#
Try this:

aggregate(a[3], a[1:2], max)
On 3/31/07, Deepak Manohar <deepakmanohar at gmail.com> wrote:
#
Both aggregate and custom functionality given by Jim works.
Thanks
On 4/1/07, Gabor Grothendieck <ggrothendieck at gmail.com> wrote: