Skip to content
Back to formatted view

Raw Message

Message-ID: <3EC25A2B.2030803@pdf.com>
Date: 2003-05-14T15:00:59Z
From: Spencer Graves
Subject: building mean/median over subgroups

Have you considered "sapply"?

hth.  spencer graves

Frank Mattes wrote:
> Dear all,
> 
> I'm trying to solve the following problem, and hoping to get some advise 
> here from the group
> 
> I have a dataframe in which the same sample was measured more than once 
> on the same day. I would reorganize the dataframe to get a single value 
> (mean /median) for one day
> 
> Patient    Day    Sample    Test
> A    1    A    23
> A    1    A    36
> A    5    B    44
> A    5    B    23
> B    2    C    10
> B    2    C    5
> 
> 
> mean
> 
> Patient    Day    Sample    Test.mean
> A    1    A    29.5
> A    5    A    33.5
> B    2    C    7.5
> 
> 
> it would be great to get some help form the list.
> 
> Yours
> Frank